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

Side by Side Diff: lib/icon.js

Issue 29339020: Issue 3868 - Use the new FilterNotifier API (Closed)
Patch Set: Created March 23, 2016, 8:15 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 | « lib/filterComposer.js ('k') | lib/requestBlocker.js » ('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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 else 66 else
67 { 67 {
68 chrome.browserAction.setIcon({ 68 chrome.browserAction.setIcon({
69 tabId: page.id, 69 tabId: page.id,
70 imageData: frames["" + opacity + whitelisted] 70 imageData: frames["" + opacity + whitelisted]
71 }); 71 });
72 } 72 }
73 } 73 }
74 74
75 FilterNotifier.addListener((action, page, filter) => 75 FilterNotifier.on("page.WhitelistingStateRevalidate", (page, filter) =>
76 { 76 {
77 if (action == "page.WhitelistingStateRevalidate") 77 whitelistedState.set(page, !!filter);
78 { 78 if (canUpdateIcon)
79 whitelistedState.set(page, !!filter); 79 setIcon(page);
80 if (canUpdateIcon)
81 setIcon(page);
82 }
83 }); 80 });
84 81
85 function renderFrames(notificationType) 82 function renderFrames(notificationType)
86 { 83 {
87 if (safariPlatform) 84 if (safariPlatform)
88 return Promise.resolve(null); 85 return Promise.resolve(null);
89 86
90 return Promise.all([ 87 return Promise.all([
91 loadImage("icons/abp-19.png"), 88 loadImage("icons/abp-19.png"),
92 loadImage("icons/abp-19-whitelisted.png"), 89 loadImage("icons/abp-19-whitelisted.png"),
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 clearInterval(interval); 210 clearInterval(interval);
214 resolve(); 211 resolve();
215 return; 212 return;
216 } 213 }
217 214
218 animateIcon(type, frames); 215 animateIcon(type, frames);
219 }, 10000); 216 }, 10000);
220 }); 217 });
221 }); 218 });
222 }; 219 };
OLDNEW
« no previous file with comments | « lib/filterComposer.js ('k') | lib/requestBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld