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

Unified Diff: chrome/background.js

Issue 29317001: Relocated icon and redesigned icon popup (Closed)
Patch Set: Applied Sebastian's suggestions and updated strings Created Nov. 26, 2013, 4:18 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « background.js ('k') | iconAnimation.js » ('j') | lib/prefs.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/background.js
===================================================================
--- a/chrome/background.js
+++ b/chrome/background.js
@@ -196,26 +196,37 @@
var sendMessage = chrome.tabs.sendMessage || chrome.tabs.sendRequest;
- var PageAction = function(tabId)
+ var BrowserAction = function(tabId)
{
this._tabId = tabId;
};
- PageAction.prototype = {
+ BrowserAction.prototype = {
setIcon: function(path)
{
- chrome.pageAction.setIcon({tabId: this._tabId, path: path});
+ chrome.browserAction.setIcon({tabId: this._tabId, path: path});
},
setTitle: function(title)
{
- chrome.pageAction.setTitle({tabId: this._tabId, title: title});
+ chrome.browserAction.setTitle({tabId: this._tabId, title: title});
},
hide: function()
{
- chrome.pageAction.hide(this._tabId);
+ chrome.browserAction.hide(this._tabId);
},
show: function()
{
- chrome.pageAction.show(this._tabId);
+ chrome.browserAction.show(this._tabId);
+ },
+ setBadgeBackgroundColor: function(color)
+ {
+ chrome.browserAction.setBadgeBackgroundColor({tabId: this._tabId, color: color});
+ },
+ setBadgeNumber: function(number)
+ {
+ chrome.browserAction.setBadgeText({
+ tabId: this._tabId,
+ text: (number === null) ? "" : number.toString()
+ });
}
Wladimir Palant 2013/12/03 12:55:43 This is a strange API - we require setting each pa
Sebastian Noack 2013/12/03 13:12:26 Safari only support numbers for the badge. That is
Wladimir Palant 2013/12/03 13:45:03 I see. I guess calling it badge.number rather than
Sebastian Noack 2013/12/03 15:03:33 I still see no advantage of a single function with
Thomas Greiner 2013/12/04 10:44:50 The reason is that in Chrome's API you can either
Sebastian Noack 2013/12/04 11:48:38 Or to set the background color only once, instead
Thomas Greiner 2013/12/10 10:09:29 The only reason is that it would be more confusing
Thomas Greiner 2013/12/11 13:15:24 Can we agree on using Wladimir's suggestion? @Fel
Felix Dahlke 2013/12/11 13:23:02 I think it's nicer API-wise to have a single funct
Thomas Greiner 2013/12/13 10:37:40 Done.
};
@@ -224,7 +235,7 @@
this._id = tab.id;
this.url = tab.url;
- this.pageAction = new PageAction(tab.id);
+ this.browserAction = new BrowserAction(tab.id);
this.onLoading = ext.tabs.onLoading._bindToTab(this);
this.onCompleted = ext.tabs.onCompleted._bindToTab(this);
« no previous file with comments | « background.js ('k') | iconAnimation.js » ('j') | lib/prefs.js » ('J')

Powered by Google App Engine
This is Rietveld