Bug 1189928 - Move Tracking Protection shield probe into browser-trackingprotection.js;r=MattN

--HG--
extra : commitid : 33AkDyE03FE
This commit is contained in:
Brian Grinstead 2015-08-04 07:41:19 -07:00
parent ba1fcc1f0a
commit 0e5ccbaee8
3 changed files with 12 additions and 18 deletions

View File

@ -63,6 +63,10 @@ let TrackingProtection = {
return Services.telemetry.getHistogramById("TRACKING_PROTECTION_EVENTS");
},
get shieldHistogram() {
return Services.telemetry.getHistogramById("TRACKING_PROTECTION_SHIELD");
},
onSecurityChange(state, isSimulated) {
if (!this.enabled) {
return;
@ -91,14 +95,21 @@ let TrackingProtection = {
gPrefService.savePrefFile(null);
this.showIntroPanel();
}
this.shieldHistogram.add(2);
} else if (isAllowing) {
this.icon.setAttribute("tooltiptext", this.disabledTooltipText);
this.icon.setAttribute("state", "loaded-tracking-content");
this.content.setAttribute("state", "loaded-tracking-content");
this.shieldHistogram.add(1);
} else {
this.icon.removeAttribute("tooltiptext");
this.icon.removeAttribute("state");
this.content.removeAttribute("state");
// We didn't show the shield
this.shieldHistogram.add(0);
}
// Telemetry for state change.

View File

@ -6869,10 +6869,6 @@ var gIdentityHandler = {
nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT |
nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT)) {
this.showBadContentDoorhanger(state);
} else if (TrackingProtection.enabled) {
// We didn't show the shield
Services.telemetry.getHistogramById("TRACKING_PROTECTION_SHIELD")
.add(0);
}
},
@ -6894,19 +6890,6 @@ var gIdentityHandler = {
// default
let iconState = "bad-content-blocked-notification-icon";
// Telemetry for whether the shield was due to tracking protection or not
let histogram = Services.telemetry.getHistogramById
("TRACKING_PROTECTION_SHIELD");
if (state & Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT) {
histogram.add(1);
} else if (state &
Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT) {
histogram.add(2);
} else if (gPrefService.getBoolPref("privacy.trackingprotection.enabled")) {
// Tracking protection is enabled but no tracking elements are loaded,
// the shield is due to mixed content.
histogram.add(3);
}
if (state &
(Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT |
Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT)) {

View File

@ -7876,7 +7876,7 @@
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 4,
"description": "Tracking protection shield (0 = not shown, 1 = loaded, 2 = blocked, 3 = due to mixed content"
"description": "Tracking protection shield (0 = not shown, 1 = loaded, 2 = blocked)"
},
"TRACKING_PROTECTION_EVENTS": {
"expires_in_version": "never",