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

Unified Diff: background.js

Issue 5196306347720704: Issue 1965 - Simplified and fixed missing image for icon animation (Closed)
Patch Set: Rebased and addressed comment Created Feb. 12, 2015, 11:15 a.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 | « no previous file | lib/icon.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -41,6 +41,12 @@
this.isThirdParty = isThirdParty;
this.extractHostFromFrame = extractHostFromFrame;
}
+with(require("icon"))
+{
+ this.updateIcon = updateIcon;
+ this.startIconAnimation = startIconAnimation;
+ this.stopIconAnimation = stopIconAnimation;
+}
var FilterStorage = require("filterStorage").FilterStorage;
var ElemHide = require("elemHide").ElemHide;
var defaultMatcher = require("matcher").defaultMatcher;
@@ -134,23 +140,11 @@
function refreshIconAndContextMenu(page)
{
var whitelisted = isPageWhitelisted(page);
-
- var iconFilename;
- if (whitelisted && require("info").platform != "safari")
- // There is no grayscale version of the icon for whitelisted pages
- // when using Safari, because icons are grayscale already and icons
- // aren't per page in Safari.
- iconFilename = "icons/abp-$size-whitelisted.png";
- else
- iconFilename = "icons/abp-$size.png";
-
- page.browserAction.setIcon(iconFilename);
- iconAnimation.registerPage(page, iconFilename);
+ updateIcon(page, whitelisted);
// show or hide the context menu entry dependent on whether
// adblocking is active on that page
page.contextMenus.removeAll();
-
if (Prefs.shouldShowBlockElementMenu && !whitelisted && htmlPages.has(page))
page.contextMenus.create(contextMenuItem);
}
@@ -276,11 +270,11 @@
activeNotification.onClicked = function()
{
if (animateIcon)
- iconAnimation.stop();
+ stopIconAnimation();
notificationClosed();
};
if (animateIcon)
- iconAnimation.update(activeNotification.type);
+ startIconAnimation(activeNotification.type);
}
function openNotificationLinks()
« no previous file with comments | « no previous file | lib/icon.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld