OLD | NEW |
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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 }, | 187 }, |
188 _prepareExtraArguments: function(urls) | 188 _prepareExtraArguments: function(urls) |
189 { | 189 { |
190 return [urls ? {urls: urls} : {}, ["blocking"]]; | 190 return [urls ? {urls: urls} : {}, ["blocking"]]; |
191 } | 191 } |
192 }; | 192 }; |
193 | 193 |
194 | 194 |
195 /* Tabs */ | 195 /* Tabs */ |
196 | 196 |
| 197 var sendMessage = chrome.tabs.sendMessage || chrome.tabs.sendRequest; |
| 198 |
197 var PageAction = function(tabId) | 199 var PageAction = function(tabId) |
198 { | 200 { |
199 this._tabId = tabId; | 201 this._tabId = tabId; |
200 }; | 202 }; |
201 PageAction.prototype = { | 203 PageAction.prototype = { |
202 setIcon: function(path) | 204 setIcon: function(path) |
203 { | 205 { |
204 chrome.pageAction.setIcon({tabId: this._tabId, path: path}); | 206 chrome.pageAction.setIcon({tabId: this._tabId, path: path}); |
205 }, | 207 }, |
206 setTitle: function(title) | 208 setTitle: function(title) |
(...skipping 26 matching lines...) Expand all Loading... |
233 close: function() | 235 close: function() |
234 { | 236 { |
235 chrome.tabs.remove(this._id); | 237 chrome.tabs.remove(this._id); |
236 }, | 238 }, |
237 activate: function() | 239 activate: function() |
238 { | 240 { |
239 chrome.tabs.update(this._id, {selected: true}); | 241 chrome.tabs.update(this._id, {selected: true}); |
240 }, | 242 }, |
241 sendMessage: function(message, responseCallback) | 243 sendMessage: function(message, responseCallback) |
242 { | 244 { |
243 chrome.tabs.sendMessage(this._id, message, responseCallback); | 245 sendMessage(this._id, message, responseCallback); |
244 } | 246 } |
245 }; | 247 }; |
246 | 248 |
247 TabMap = function() | 249 TabMap = function() |
248 { | 250 { |
249 this._map = {}; | 251 this._map = {}; |
250 this.delete = this.delete.bind(this); | 252 this.delete = this.delete.bind(this); |
251 }; | 253 }; |
252 TabMap.prototype = { | 254 TabMap.prototype = { |
253 get: function(tab) | 255 get: function(tab) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 onCompleted: new CompletedTabEventTarget(), | 344 onCompleted: new CompletedTabEventTarget(), |
343 onActivated: new ActivatedTabEventTarget(), | 345 onActivated: new ActivatedTabEventTarget(), |
344 onRemoved: new RemovedTabEventTarget() | 346 onRemoved: new RemovedTabEventTarget() |
345 }; | 347 }; |
346 | 348 |
347 ext.webRequest = { | 349 ext.webRequest = { |
348 onBeforeRequest: new BeforeRequestEventTarget(), | 350 onBeforeRequest: new BeforeRequestEventTarget(), |
349 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged | 351 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged |
350 }; | 352 }; |
351 })(); | 353 })(); |
OLD | NEW |