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

Side by Side Diff: lib/stats.js

Issue 5693109165883392: Issue 2040 - Replaced localStorage with chrome.storage.local (Closed)
Patch Set: Rebased and renamed onProgress() to checkLoaded() Created April 8, 2015, 3:12 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
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (Prefs.show_statsinicon) 72 if (Prefs.show_statsinicon)
73 { 73 {
74 page.browserAction.setBadge({ 74 page.browserAction.setBadge({
75 color: badgeColor, 75 color: badgeColor,
76 number: pageStats.blocked 76 number: pageStats.blocked
77 }); 77 });
78 } 78 }
79 } 79 }
80 }); 80 });
81 81
82 Prefs.addListener(function(name) 82 Prefs.onChanged.addListener(function(name)
83 { 83 {
84 if (name != "show_statsinicon") 84 if (name != "show_statsinicon")
85 return; 85 return;
86 86
87 ext.pages.query({}, function(pages) 87 ext.pages.query({}, function(pages)
88 { 88 {
89 for (var i = 0; i < pages.length; i++) 89 for (var i = 0; i < pages.length; i++)
90 { 90 {
91 let page = pages[i]; 91 let page = pages[i];
92 let badge = null; 92 let badge = null;
93 93
94 if (Prefs.show_statsinicon) 94 if (Prefs.show_statsinicon)
95 { 95 {
96 let pageStats = statsPerPage.get(page); 96 let pageStats = statsPerPage.get(page);
97 if (pageStats && "blocked" in pageStats) 97 if (pageStats && "blocked" in pageStats)
98 { 98 {
99 badge = { 99 badge = {
100 color: badgeColor, 100 color: badgeColor,
101 number: pageStats.blocked 101 number: pageStats.blocked
102 }; 102 };
103 } 103 }
104 } 104 }
105 105
106 page.browserAction.setBadge(badge); 106 page.browserAction.setBadge(badge);
107 } 107 }
108 }); 108 });
109 }); 109 });
OLDNEW
« background.js ('K') | « lib/prefs.js ('k') | lib/storage/io.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld