LEFT | RIGHT |
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 Loading... |
210 chrome.browserAction.setTitle({tabId: this._tabId, title: title}); | 210 chrome.browserAction.setTitle({tabId: this._tabId, title: title}); |
211 }, | 211 }, |
212 hide: function() | 212 hide: function() |
213 { | 213 { |
214 chrome.browserAction.hide(this._tabId); | 214 chrome.browserAction.hide(this._tabId); |
215 }, | 215 }, |
216 show: function() | 216 show: function() |
217 { | 217 { |
218 chrome.browserAction.show(this._tabId); | 218 chrome.browserAction.show(this._tabId); |
219 }, | 219 }, |
220 setBadgeBackgroundColor: function(color) | 220 setBadge: function(badge) |
221 { | 221 { |
222 chrome.browserAction.setBadgeBackgroundColor({tabId: this._tabId, color: c
olor}); | 222 if (!badge) |
223 }, | 223 { |
224 setBadgeNumber: function(number) | 224 chrome.browserAction.setBadgeText({ |
225 { | 225 tabId: this._tabId, |
226 chrome.browserAction.setBadgeText({ | 226 text: "" |
227 tabId: this._tabId, | 227 }); |
228 text: (number === null) ? "" : number.toString() | 228 return; |
229 }); | 229 } |
| 230 |
| 231 if ("color" in badge) |
| 232 { |
| 233 chrome.browserAction.setBadgeBackgroundColor({ |
| 234 tabId: this._tabId, |
| 235 color: badge.color |
| 236 }); |
| 237 } |
| 238 |
| 239 if ("number" in badge) |
| 240 { |
| 241 chrome.browserAction.setBadgeText({ |
| 242 tabId: this._tabId, |
| 243 text: badge.number.toString() |
| 244 }); |
| 245 } |
230 } | 246 } |
231 }; | 247 }; |
232 | 248 |
233 Tab = function(tab) | 249 Tab = function(tab) |
234 { | 250 { |
235 this._id = tab.id; | 251 this._id = tab.id; |
236 | 252 |
237 this.url = tab.url; | 253 this.url = tab.url; |
238 this.browserAction = new BrowserAction(tab.id); | 254 this.browserAction = new BrowserAction(tab.id); |
239 | 255 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 onCompleted: new CompletedTabEventTarget(), | 371 onCompleted: new CompletedTabEventTarget(), |
356 onActivated: new ActivatedTabEventTarget(), | 372 onActivated: new ActivatedTabEventTarget(), |
357 onRemoved: new RemovedTabEventTarget() | 373 onRemoved: new RemovedTabEventTarget() |
358 }; | 374 }; |
359 | 375 |
360 ext.webRequest = { | 376 ext.webRequest = { |
361 onBeforeRequest: new BeforeRequestEventTarget(), | 377 onBeforeRequest: new BeforeRequestEventTarget(), |
362 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged | 378 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged |
363 }; | 379 }; |
364 })(); | 380 })(); |
LEFT | RIGHT |