Bug 787738 - Telemetry for Geolocation Prompt UI (r=felipe)

This commit is contained in:
Devdatta Akhawe 2012-09-08 09:20:51 -07:00
parent c8cb2fef04
commit 527595912d
2 changed files with 19 additions and 1 deletions

View File

@ -1638,11 +1638,15 @@ ContentPermissionPrompt.prototype = {
}
var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
let secHistogram = Components.classes["@mozilla.org/base/telemetry;1"].
getService(Ci.nsITelemetry).
getHistogramById("SECURITY_UI");
var mainAction = {
label: browserBundle.GetStringFromName("geolocation.shareLocation"),
accessKey: browserBundle.GetStringFromName("geolocation.shareLocation.accesskey"),
callback: function() {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST_SHARE_LOCATION);
request.allow();
},
};
@ -1667,6 +1671,7 @@ ContentPermissionPrompt.prototype = {
accessKey: browserBundle.GetStringFromName("geolocation.alwaysShareLocation.accesskey"),
callback: function () {
Services.perms.addFromPrincipal(requestingPrincipal, "geo", Ci.nsIPermissionManager.ALLOW_ACTION);
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST_ALWAYS_SHARE);
request.allow();
}
});
@ -1675,6 +1680,7 @@ ContentPermissionPrompt.prototype = {
accessKey: browserBundle.GetStringFromName("geolocation.neverShareLocation.accesskey"),
callback: function () {
Services.perms.addFromPrincipal(requestingPrincipal, "geo", Ci.nsIPermissionManager.DENY_ACTION);
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST_NEVER_SHARE);
request.cancel();
}
});
@ -1683,6 +1689,7 @@ ContentPermissionPrompt.prototype = {
var browser = chromeWin.gBrowser.getBrowserForDocument(requestingWindow.document);
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_GEOLOCATION_REQUEST);
chromeWin.PopupNotifications.show(browser, "geolocation", message, "geo-notification-icon",
mainAction, secondaryActions);
}

View File

@ -6,7 +6,7 @@
#include "nsISupports.idl"
[scriptable, uuid(454b5cbb-fd18-4f34-a616-4d543f68717d)]
[scriptable, uuid(f277021f-8508-456e-b2b2-784c6faa0011)]
interface nsISecurityUITelemetry : nsISupports {
@ -83,4 +83,15 @@ const uint32_t WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_FLAG_DOMAIN = 2;
const uint32_t WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_FLAG_TIME = 4;
// This uses up buckets till 45
/*
* Geolocation Popup Telemetry
*/
const uint32_t WARNING_GEOLOCATION_REQUEST = 46;
const uint32_t WARNING_GEOLOCATION_REQUEST_SHARE_LOCATION = 47;
const uint32_t WARNING_GEOLOCATION_REQUEST_ALWAYS_SHARE = 48;
const uint32_t WARNING_GEOLOCATION_REQUEST_NEVER_SHARE = 49;
// It would be nice to measure the two cases of user clicking
// "not now", and user closing the popup. This is currently not implemented.
};