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-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 var sendMessage = chrome.tabs.sendMessage || chrome.tabs.sendRequest; | 200 var sendMessage = chrome.tabs.sendMessage || chrome.tabs.sendRequest; |
201 | 201 |
202 var BrowserAction = function(tabId) | 202 var BrowserAction = function(tabId) |
203 { | 203 { |
204 this._tabId = tabId; | 204 this._tabId = tabId; |
205 }; | 205 }; |
206 BrowserAction.prototype = { | 206 BrowserAction.prototype = { |
207 setIcon: function(path) | 207 setIcon: function(path) |
208 { | 208 { |
209 chrome.browserAction.setIcon({tabId: this._tabId, path: path}); | 209 var paths = {}; |
| 210 for (var i = 1; i <= 2; i++) |
| 211 { |
| 212 var size = i * 19; |
| 213 paths[size] = path.replace("$size", size); |
| 214 } |
| 215 |
| 216 chrome.browserAction.setIcon({tabId: this._tabId, path: paths}); |
210 }, | 217 }, |
211 setBadge: function(badge) | 218 setBadge: function(badge) |
212 { | 219 { |
213 if (!badge) | 220 if (!badge) |
214 { | 221 { |
215 chrome.browserAction.setBadgeText({ | 222 chrome.browserAction.setBadgeText({ |
216 tabId: this._tabId, | 223 tabId: this._tabId, |
217 text: "" | 224 text: "" |
218 }); | 225 }); |
219 return; | 226 return; |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 if (isContextMenuHidden) | 596 if (isContextMenuHidden) |
590 return; | 597 return; |
591 | 598 |
592 chrome.contextMenus.removeAll(); | 599 chrome.contextMenus.removeAll(); |
593 isContextMenuHidden = true; | 600 isContextMenuHidden = true; |
594 } | 601 } |
595 }; | 602 }; |
596 | 603 |
597 ext.onMessage = new BackgroundMessageEventTarget(); | 604 ext.onMessage = new BackgroundMessageEventTarget(); |
598 })(); | 605 })(); |
OLD | NEW |