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

Delta Between Two Patch Sets: chrome/background.js

Issue 29317001: Relocated icon and redesigned icon popup (Closed)
Left Patch Set: Created Nov. 7, 2013, 5:44 p.m.
Right Patch Set: Merged setBadgeNumber and setBadgeBackgroundColor Created Dec. 13, 2013, 10:36 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « background.js ('k') | iconAnimation.js » ('j') | lib/stats.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; 197 var sendMessage = chrome.tabs.sendMessage || chrome.tabs.sendRequest;
198 198
199 var PageAction = function(tabId) 199 var BrowserAction = function(tabId)
200 { 200 {
201 this._tabId = tabId; 201 this._tabId = tabId;
202 }; 202 };
203 PageAction.prototype = { 203 BrowserAction.prototype = {
204 setIcon: function(path) 204 setIcon: function(path)
205 { 205 {
206 chrome.pageAction.setIcon({tabId: this._tabId, path: path}); 206 chrome.browserAction.setIcon({tabId: this._tabId, path: path});
207 }, 207 },
208 setTitle: function(title) 208 setTitle: function(title)
209 { 209 {
210 chrome.pageAction.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.pageAction.hide(this._tabId); 214 chrome.browserAction.hide(this._tabId);
215 }, 215 },
216 show: function() 216 show: function()
217 { 217 {
218 chrome.pageAction.show(this._tabId); 218 chrome.browserAction.show(this._tabId);
219 },
220 setBadge: function(badge)
221 {
222 if (!badge)
223 {
224 chrome.browserAction.setBadgeText({
225 tabId: this._tabId,
226 text: ""
227 });
228 return;
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 }
219 } 246 }
220 }; 247 };
221 248
222 Tab = function(tab) 249 Tab = function(tab)
223 { 250 {
224 this._id = tab.id; 251 this._id = tab.id;
225 252
226 this.url = tab.url; 253 this.url = tab.url;
227 this.pageAction = new PageAction(tab.id); 254 this.browserAction = new BrowserAction(tab.id);
228 255
229 this.onLoading = ext.tabs.onLoading._bindToTab(this); 256 this.onLoading = ext.tabs.onLoading._bindToTab(this);
230 this.onCompleted = ext.tabs.onCompleted._bindToTab(this); 257 this.onCompleted = ext.tabs.onCompleted._bindToTab(this);
231 this.onActivated = ext.tabs.onActivated._bindToTab(this); 258 this.onActivated = ext.tabs.onActivated._bindToTab(this);
232 this.onRemoved = ext.tabs.onRemoved._bindToTab(this); 259 this.onRemoved = ext.tabs.onRemoved._bindToTab(this);
233 }; 260 };
234 Tab.prototype = { 261 Tab.prototype = {
235 close: function() 262 close: function()
236 { 263 {
237 chrome.tabs.remove(this._id); 264 chrome.tabs.remove(this._id);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 onCompleted: new CompletedTabEventTarget(), 371 onCompleted: new CompletedTabEventTarget(),
345 onActivated: new ActivatedTabEventTarget(), 372 onActivated: new ActivatedTabEventTarget(),
346 onRemoved: new RemovedTabEventTarget() 373 onRemoved: new RemovedTabEventTarget()
347 }; 374 };
348 375
349 ext.webRequest = { 376 ext.webRequest = {
350 onBeforeRequest: new BeforeRequestEventTarget(), 377 onBeforeRequest: new BeforeRequestEventTarget(),
351 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged 378 handlerBehaviorChanged: chrome.webRequest.handlerBehaviorChanged
352 }; 379 };
353 })(); 380 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld