From d59e4ae5e84ee1ee463a2df4ece79d7d01533f7b Mon Sep 17 00:00:00 2001 From: Margaret Leibovic Date: Fri, 18 Dec 2015 14:30:24 -0500 Subject: [PATCH] Bug 1228090 - Update traacking protection telemetry histogram to represent user setting. r=mfinkle --HG-- extra : commitid : ID0STPnNMfB extra : rebase_source : 205146246a35eee158845fec4b788edd7018dafa --- mobile/android/chrome/content/browser.js | 27 ++++++++++++-------- toolkit/components/telemetry/Histograms.json | 8 ++++++ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/mobile/android/chrome/content/browser.js b/mobile/android/chrome/content/browser.js index c4cd9abb89a5..db3a0bd0afee 100644 --- a/mobile/android/chrome/content/browser.js +++ b/mobile/android/chrome/content/browser.js @@ -594,10 +594,7 @@ var BrowserApp = { if (AppConstants.NIGHTLY_BUILD) { InitLater(() => ShumwayUtils.init(), window, "ShumwayUtils"); - InitLater(() => Telemetry.addData("TRACKING_PROTECTION_ENABLED", - Services.prefs.getBoolPref("privacy.trackingprotection.enabled"))); - InitLater(() => Telemetry.addData("TRACKING_PROTECTION_PBM_DISABLED", - !Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled"))); + InitLater(() => Telemetry.addData("FENNEC_TRACKING_PROTECTION_STATE", parseInt(BrowserApp.getTrackingProtectionState()))); InitLater(() => WebcompatReporter.init()); } @@ -1448,6 +1445,20 @@ var BrowserApp = { PREF_TRACKING_PROTECTION_ENABLED_PB: "1", PREF_TRACKING_PROTECTION_DISABLED: "0", + /** + * Returns the current state of the tracking protection pref. + * (0 = Disabled, 1 = Enabled in PB, 2 = Enabled) + */ + getTrackingProtectionState: function() { + if (Services.prefs.getBoolPref("privacy.trackingprotection.enabled")) { + return this.PREF_TRACKING_PROTECTION_ENABLED; + } + if (Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled")) { + return this.PREF_TRACKING_PROTECTION_ENABLED_PB; + } + return this.PREF_TRACKING_PROTECTION_DISABLED; + }, + handlePreferencesRequest: function handlePreferencesRequest(aRequestId, aPrefNames, aListen) { @@ -1488,13 +1499,7 @@ var BrowserApp = { continue; case "privacy.trackingprotection.state": { pref.type = "string"; - if (Services.prefs.getBoolPref("privacy.trackingprotection.enabled")) { - pref.value = this.PREF_TRACKING_PROTECTION_ENABLED; - } else if (Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled")) { - pref.value = this.PREF_TRACKING_PROTECTION_ENABLED_PB; - } else { - pref.value = this.PREF_TRACKING_PROTECTION_DISABLED; - } + pref.value = this.getTrackingProtectionState(); prefs.push(pref); continue; } diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 734d252f44fd..e8315607c41e 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -8472,6 +8472,14 @@ "kind": "boolean", "description": "Is the tracking protection in private browsing mode disabled?" }, + "FENNEC_TRACKING_PROTECTION_STATE": { + "expires_in_version": "60", + "kind": "enumerated", + "n_values": 5, + "description": "The state of the user-visible tracking protection setting (0 = Disabled, 1 = Enabled in PB, 2 = Enabled)", + "alert_emails": ["mleibovic@mozilla.com"], + "bug_numbers": [1228090] + }, "TRACKING_PROTECTION_SHIELD": { "expires_in_version": "never", "kind": "enumerated",