| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 _applyChanges() | 326 _applyChanges() |
| 327 { | 327 { |
| 328 if ("iconPath" in this._changes) | 328 if ("iconPath" in this._changes) |
| 329 { | 329 { |
| 330 // Firefox for Android displays the browser action not as an icon but | 330 // Firefox for Android displays the browser action not as an icon but |
| 331 // as a menu item. There is no icon, but such an option may be added in | 331 // as a menu item. There is no icon, but such an option may be added in |
| 332 // the future. | 332 // the future. |
| 333 // https://bugzilla.mozilla.org/show_bug.cgi?id=1331746 | 333 // https://bugzilla.mozilla.org/show_bug.cgi?id=1331746 |
| 334 if ("setIcon" in chrome.browserAction) | 334 if ("setIcon" in chrome.browserAction) |
| 335 { | 335 { |
| 336 chrome.browserAction.setIcon({ | 336 let path = { |
| 337 tabId: this._tabId, | 337 16: this._changes.iconPath.replace("$size", "16"), |
| 338 path: { | 338 19: this._changes.iconPath.replace("$size", "19"), |
| 339 16: this._changes.iconPath.replace("$size", "16"), | 339 20: this._changes.iconPath.replace("$size", "20"), |
| 340 19: this._changes.iconPath.replace("$size", "19"), | 340 32: this._changes.iconPath.replace("$size", "32"), |
| 341 20: this._changes.iconPath.replace("$size", "20"), | 341 38: this._changes.iconPath.replace("$size", "38"), |
| 342 32: this._changes.iconPath.replace("$size", "32"), | 342 40: this._changes.iconPath.replace("$size", "40") |
| 343 38: this._changes.iconPath.replace("$size", "38"), | 343 }; |
| 344 40: this._changes.iconPath.replace("$size", "40") | 344 try |
| 345 } | 345 { |
| 346 }); | 346 chrome.browserAction.setIcon({tabId: this._tabId, path}); |
| 347 } |
| 348 catch (e) |
| 349 { |
| 350 // Edge throws if passed icon sizes different than 19,20,38,40px. |
| 351 delete path[16]; |
| 352 delete path[32]; |
| 353 chrome.browserAction.setIcon({tabId: this._tabId, path}); |
| 354 } |
| 347 } | 355 } |
| 348 } | 356 } |
| 349 | 357 |
| 350 if ("badgeText" in this._changes) | 358 if ("badgeText" in this._changes) |
| 351 { | 359 { |
| 352 // There is no badge on Firefox for Android; the browser action is | 360 // There is no badge on Firefox for Android; the browser action is |
| 353 // simply a menu item. | 361 // simply a menu item. |
| 354 if ("setBadgeText" in chrome.browserAction) | 362 if ("setBadgeText" in chrome.browserAction) |
| 355 { | 363 { |
| 356 chrome.browserAction.setBadgeText({ | 364 chrome.browserAction.setBadgeText({ |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 ext.windows = { | 697 ext.windows = { |
| 690 create(createData, callback) | 698 create(createData, callback) |
| 691 { | 699 { |
| 692 chrome.windows.create(createData, createdWindow => | 700 chrome.windows.create(createData, createdWindow => |
| 693 { | 701 { |
| 694 afterTabLoaded(callback)(createdWindow.tabs[0]); | 702 afterTabLoaded(callback)(createdWindow.tabs[0]); |
| 695 }); | 703 }); |
| 696 } | 704 } |
| 697 }; | 705 }; |
| 698 }()); | 706 }()); |
| LEFT | RIGHT |