Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: chrome/background.js

Issue 16067002: Added Safari Support (Closed)
Left Patch Set: Removed absolute URL fix for Safari (this is done by the buildtools now), introduced browser specif… Created Oct. 31, 2013, 10:50 a.m.
Right Patch Set: Bugfixes Created Nov. 15, 2013, 8:58 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « block.js ('k') | chrome/common.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 hide: function() 210 hide: function()
211 { 211 {
212 chrome.pageAction.hide(this._tabId); 212 chrome.pageAction.hide(this._tabId);
213 }, 213 },
214 show: function() 214 show: function()
215 { 215 {
216 chrome.pageAction.show(this._tabId); 216 chrome.pageAction.show(this._tabId);
217 } 217 }
218 }; 218 };
219 219
220 Tab = function(tab) { 220 Tab = function(tab)
221 {
221 this._id = tab.id; 222 this._id = tab.id;
222 223
223 this.url = tab.url; 224 this.url = tab.url;
224 this.pageAction = new PageAction(tab.id); 225 this.pageAction = new PageAction(tab.id);
225 226
226 this.onBeforeNavigate = ext.tabs.onBeforeNavigate._bindToTab(this); 227 this.onBeforeNavigate = ext.tabs.onBeforeNavigate._bindToTab(this);
227 this.onCompleted = ext.tabs.onCompleted._bindToTab(this); 228 this.onCompleted = ext.tabs.onCompleted._bindToTab(this);
228 this.onActivated = ext.tabs.onActivated._bindToTab(this); 229 this.onActivated = ext.tabs.onActivated._bindToTab(this);
229 this.onRemoved = ext.tabs.onRemoved._bindToTab(this); 230 this.onRemoved = ext.tabs.onRemoved._bindToTab(this);
230 }; 231 };
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 has: function(tab) 264 has: function(tab)
264 { 265 {
265 return tab._id in this._map; 266 return tab._id in this._map;
266 }, 267 },
267 clear: function() 268 clear: function()
268 { 269 {
269 for (var id in this._map) 270 for (var id in this._map)
270 this.delete(this._map[id].tab); 271 this.delete(this._map[id].tab);
271 } 272 }
272 }; 273 };
273 TabMap.prototype["delete"] = function(tab) { 274 TabMap.prototype["delete"] = function(tab)
275 {
274 delete this._map[tab._id]; 276 delete this._map[tab._id];
275 tab.onRemoved.removeListener(this.delete); 277 tab.onRemoved.removeListener(this.delete);
276 }; 278 };
277 279
278 280
279 /* Windows */ 281 /* Windows */
280 282
281 Window = function(win) { 283 Window = function(win)
284 {
282 this._id = win.id; 285 this._id = win.id;
283 this.visible = win.status != "minimized"; 286 this.visible = win.status != "minimized";
284 }; 287 };
285 Window.prototype = { 288 Window.prototype = {
286 getAllTabs: function(callback) 289 getAllTabs: function(callback)
287 { 290 {
288 chrome.tabs.query({windowId: this._id}, function(tabs) 291 chrome.tabs.query({windowId: this._id}, function(tabs)
289 { 292 {
290 callback(tabs.map(function(tab) { return new Tab(tab); })); 293 callback(tabs.map(function(tab) { return new Tab(tab); }));
291 }); 294 });
(...skipping 12 matching lines...) Expand all
304 if (!callback) 307 if (!callback)
305 chrome.tabs.create(props); 308 chrome.tabs.create(props);
306 else 309 else
307 chrome.tabs.create(props, function(tab) 310 chrome.tabs.create(props, function(tab)
308 { 311 {
309 callback(new Tab(tab)); 312 callback(new Tab(tab));
310 }); 313 });
311 } 314 }
312 }; 315 };
313 316
314 317
315 /* API */ 318 /* API */
316 319
317 ext.windows = { 320 ext.windows = {
318 getAll: function(callback) 321 getAll: function(callback)
319 { 322 {
320 chrome.windows.getAll(function(windows) 323 chrome.windows.getAll(function(windows)
321 { 324 {
322 callback(windows.map(function(win) 325 callback(windows.map(function(win)
323 { 326 {
324 return new Window(win); 327 return new Window(win);
(...skipping 14 matching lines...) Expand all
339 onCompleted: new CompletedTabEventTarget(), 342 onCompleted: new CompletedTabEventTarget(),
340 onActivated: new ActivatedTabEventTarget(), 343 onActivated: new ActivatedTabEventTarget(),
341 onRemoved: new RemovedTabEventTarget() 344 onRemoved: new RemovedTabEventTarget()
342 }; 345 };
343 346
344 ext.webRequest = { 347 ext.webRequest = {
345 onBeforeRequest: new BeforeRequestEventTarget(), 348 onBeforeRequest: new BeforeRequestEventTarget(),
346 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged 349 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged
347 }; 350 };
348 })(); 351 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld