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

Side by Side Diff: chrome/background.js

Issue 6369485355220992: Fixed reload issue in Chrome (Closed)
Patch Set: Created Nov. 15, 2013, 1:44 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « background.js ('k') | safari/background.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 }, 92 },
93 _removeTab: function(tab) 93 _removeTab: function(tab)
94 { 94 {
95 delete this._tabs[tab._id]; 95 delete this._tabs[tab._id];
96 96
97 if (Object.keys(this._tabs).length == 0) 97 if (Object.keys(this._tabs).length == 0)
98 this.removeListener(this._sharedListener); 98 this.removeListener(this._sharedListener);
99 } 99 }
100 }; 100 };
101 101
102 var BeforeNavigateTabEventTarget = function() 102 var LoadingTabEventTarget = function()
103 { 103 {
104 TabEventTarget.call(this, chrome.tabs.onUpdated); 104 TabEventTarget.call(this, chrome.tabs.onUpdated);
105 }; 105 };
106 BeforeNavigateTabEventTarget.prototype = { 106 LoadingTabEventTarget.prototype = {
107 __proto__: TabEventTarget.prototype, 107 __proto__: TabEventTarget.prototype,
108 _wrapListener: function(listener) 108 _wrapListener: function(listener)
109 { 109 {
110 return function(id, info, tab) 110 return function(id, info, tab)
111 { 111 {
112 if ("url" in info) 112 if (info.status == "loading")
113 listener(new Tab(tab)); 113 listener(new Tab(tab));
114 }; 114 };
115 } 115 }
116 }; 116 };
117 117
118 var CompletedTabEventTarget = function() 118 var CompletedTabEventTarget = function()
119 { 119 {
120 TabEventTarget.call(this, chrome.tabs.onUpdated); 120 TabEventTarget.call(this, chrome.tabs.onUpdated);
121 }; 121 };
122 CompletedTabEventTarget.prototype = { 122 CompletedTabEventTarget.prototype = {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 }; 218 };
219 219
220 Tab = function(tab) 220 Tab = function(tab)
221 { 221 {
222 this._id = tab.id; 222 this._id = tab.id;
223 223
224 this.url = tab.url; 224 this.url = tab.url;
225 this.pageAction = new PageAction(tab.id); 225 this.pageAction = new PageAction(tab.id);
226 226
227 this.onBeforeNavigate = ext.tabs.onBeforeNavigate._bindToTab(this); 227 this.onLoading = ext.tabs.onLoading._bindToTab(this);
228 this.onCompleted = ext.tabs.onCompleted._bindToTab(this); 228 this.onCompleted = ext.tabs.onCompleted._bindToTab(this);
229 this.onActivated = ext.tabs.onActivated._bindToTab(this); 229 this.onActivated = ext.tabs.onActivated._bindToTab(this);
230 this.onRemoved = ext.tabs.onRemoved._bindToTab(this); 230 this.onRemoved = ext.tabs.onRemoved._bindToTab(this);
231 }; 231 };
232 Tab.prototype = { 232 Tab.prototype = {
233 close: function() 233 close: function()
234 { 234 {
235 chrome.tabs.remove(this._id); 235 chrome.tabs.remove(this._id);
236 }, 236 },
237 activate: function() 237 activate: function()
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 getLastFocused: function(callback) 331 getLastFocused: function(callback)
332 { 332 {
333 chrome.windows.getLastFocused(function(win) 333 chrome.windows.getLastFocused(function(win)
334 { 334 {
335 callback(new Window(win)); 335 callback(new Window(win));
336 }); 336 });
337 } 337 }
338 }; 338 };
339 339
340 ext.tabs = { 340 ext.tabs = {
341 onBeforeNavigate: new BeforeNavigateTabEventTarget(), 341 onLoading: new LoadingTabEventTarget(),
342 onCompleted: new CompletedTabEventTarget(), 342 onCompleted: new CompletedTabEventTarget(),
343 onActivated: new ActivatedTabEventTarget(), 343 onActivated: new ActivatedTabEventTarget(),
344 onRemoved: new RemovedTabEventTarget() 344 onRemoved: new RemovedTabEventTarget()
345 }; 345 };
346 346
347 ext.webRequest = { 347 ext.webRequest = {
348 onBeforeRequest: new BeforeRequestEventTarget(), 348 onBeforeRequest: new BeforeRequestEventTarget(),
349 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged 349 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged
350 }; 350 };
351 })(); 351 })();
OLDNEW
« no previous file with comments | « background.js ('k') | safari/background.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld