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

Side by Side Diff: chrome/ext/background.js

Issue 5838171610808320: Added high resolution icons for Retina displays (Closed)
Patch Set: Created April 2, 2014, 3:17 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') | chrome/icons/abp-38.png » ('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-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
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(/((?:.*\/)*.+?\b)/, '$1-' + size);
Wladimir Palant 2014/04/02 16:37:24 This is rather non-obvious behavior. It should be
Sebastian Noack 2014/04/02 17:02:08 But then we would need something like |path.replac
Wladimir Palant 2014/04/03 05:43:40 No, path.replace("$size", "16") should do, the ico
Sebastian Noack 2014/04/03 11:42:26 I somewhat agree. Here you go.
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
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 })();
OLDNEW
« no previous file with comments | « background.js ('k') | chrome/icons/abp-38.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld