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

Unified Diff: lib/ui.js

Issue 6337686776315904: Issue 394 - hit statistics tool data collection (Closed)
Patch Set: Created Feb. 17, 2015, 4:34 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
« lib/filterStorage.js ('K') | « lib/filterStorage.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/ui.js
===================================================================
--- a/lib/ui.js
+++ b/lib/ui.js
@@ -23,6 +23,7 @@
let {Policy} = require("contentPolicy");
let {FilterStorage} = require("filterStorage");
let {FilterNotifier} = require("filterNotifier");
+let {FilterHits} = require("filterHits");
let {RequestNotifier} = require("requestNotifier");
let {Filter} = require("filterClasses");
let {Subscription, SpecialSubscription, DownloadableSubscription} = require("subscriptionClasses");
@@ -1196,10 +1197,29 @@
FilterStorage.resetHitCounts();
Prefs.savestats = false;
+ if (Prefs.sendstats)
+ {
+ this.toggleSendStats();
+ return;
Thomas Greiner 2015/02/23 18:43:05 The function returns here anyway so this `return`
saroyanm 2015/02/28 15:24:30 Done.
+ }
}
else
Prefs.savestats = true;
},
+
+ /**
+ * Toggles "Send stats" option.
+ */
+ toggleSendStats: function(window)
+ {
+ if (Prefs.sendstats)
+ {
+ FilterHits.resetFilterHits();
+ Prefs.sendstats = false;
+ }
+ else
+ Prefs.sendstats = true;
+ },
/**
* Sets the current filter subscription in a single-subscription scenario,
@@ -1539,6 +1559,7 @@
setChecked(prefix + "disabled", !Prefs.enabled);
setChecked(prefix + "frameobjects", Prefs.frameobjects);
setChecked(prefix + "savestats", Prefs.savestats);
+ setChecked(prefix + "sendstats", Prefs.sendstats);
let {defaultToolbarPosition, statusbarPosition} = require("appSupport");
let hasToolbar = defaultToolbarPosition;
@@ -1947,6 +1968,7 @@
["abp-command-togglepagewhitelist", "command", function() { UI.toggleFilter(pageWhitelist); }],
["abp-command-toggleobjtabs", "command", UI.togglePref.bind(UI, "frameobjects")],
["abp-command-togglesavestats", "command", UI.toggleSaveStats.bind(UI)],
+ ["abp-command-togglesendstats", "command", UI.toggleSendStats.bind(UI)],
["abp-command-togglesync", "command", UI.toggleSync.bind(UI)],
["abp-command-toggleshowintoolbar", "command", UI.toggleToolbarIcon.bind(UI)],
["abp-command-toggleshowinstatusbar", "command", UI.togglePref.bind(UI, "showinstatusbar")],
« lib/filterStorage.js ('K') | « lib/filterStorage.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld