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

Unified Diff: lib/icon.js

Issue 29338764: Issue 3842 - Split up the logic updating the icon and context menu (Closed)
Patch Set: Prevent visible delays Created March 21, 2016, 10:10 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 | « lib/filterComposer.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/icon.js
===================================================================
--- a/lib/icon.js
+++ b/lib/icon.js
@@ -19,6 +19,8 @@
"use strict";
+let {FilterNotifier} = require("filterNotifier");
+
const frameOpacities = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.0];
@@ -70,6 +72,16 @@
}
}
+FilterNotifier.addListener((action, page, filter) =>
+{
+ if (action == "page.WhitelistingStateRevalidate")
+ {
+ whitelistedState.set(page, !!filter);
+ if (canUpdateIcon)
+ setIcon(page);
+ }
+});
+
function renderFrames(notificationType)
{
if (safariPlatform)
@@ -155,20 +167,6 @@
});
}
-/**
- * Set the browser action icon for the given page, indicating whether
- * adblocking is active there, and considering the icon animation.
- *
- * @param {Page} page The page to set the browser action icon for
- * @param {Boolean} whitelisted Whether the page has been whitelisted
- */
-exports.updateIcon = function(page, whitelisted)
-{
- whitelistedState.set(page, whitelisted);
- if (canUpdateIcon)
- setIcon(page);
-};
-
let stopIconAnimation =
/**
* Stops to animate the browser action icon
« no previous file with comments | « lib/filterComposer.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld