Bug 1219030, Part 2 - Collect notification management UI telemetry. draft
authorKit Cambridge <kcambridge@mozilla.com>
Fri, 13 Nov 2015 21:22:59 -0800
changeset 308830 6ecbc59089d9a5677f2123e24b7ba0fc83b33697
parent 308829 24283c60158bc0123488c35c55596773478d7e9f
child 511224 4bd9f92f1465b5e7ca0e594ab681af4a2bceedef
push id7538
push userkcambridge@mozilla.com
push dateSat, 14 Nov 2015 06:42:35 +0000
bugs1219030
milestone45.0a1
Bug 1219030, Part 2 - Collect notification management UI telemetry.
browser/components/preferences/in-content/content.js
toolkit/components/telemetry/Histograms.json
--- a/browser/components/preferences/in-content/content.js
+++ b/browser/components/preferences/in-content/content.js
@@ -127,16 +127,19 @@ var gContentPane = {
   {
     let bundlePreferences = document.getElementById("bundlePreferences");
     let params = { permissionType: "desktop-notification" };
     params.windowTitle = bundlePreferences.getString("notificationspermissionstitle");
     params.introText = bundlePreferences.getString("notificationspermissionstext4");
 
     gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
                     "resizable=yes", params);
+
+    Services.telemetry.getHistogramById(
+      "NOTIFICATION_EXCEPTIONS_OPENED").add();
   },
 
 
   // POP-UPS
 
   /**
    * Displays the popup exceptions dialog where specific site popup preferences
    * can be set.
@@ -166,17 +169,17 @@ var gContentPane = {
     // Force flush:
     preferences.clientHeight;
     var langGroupPref = document.getElementById("font.language.group");
     this._selectDefaultLanguageGroup(langGroupPref.value,
                                      this._readDefaultFontTypeForLanguage(langGroupPref.value) == "serif");
   },
 
   /**
-   * 
+   *
    */
   _selectDefaultLanguageGroup: function (aLanguageGroup, aIsSerif)
   {
     const kFontNameFmtSerif         = "font.name.serif.%LANG%";
     const kFontNameFmtSansSerif     = "font.name.sans-serif.%LANG%";
     const kFontNameListFmtSerif     = "font.name-list.serif.%LANG%";
     const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
     const kFontSizeFmtVariable      = "font.size.variable.%LANG%";
@@ -238,17 +241,17 @@ var gContentPane = {
       document.getElementById("contentPreferences").appendChild(preference);
     }
     return preference.value;
   },
 
   /**
    * Displays the fonts dialog, where web page font names and sizes can be
    * configured.
-   */  
+   */
   configureFonts: function ()
   {
     gSubDialog.open("chrome://browser/content/preferences/fonts.xul", "resizable=no");
   },
 
   /**
    * Displays the colors dialog, where default web page/link/etc. colors can be
    * configured.
@@ -280,11 +283,15 @@ var gContentPane = {
   openTranslationProviderAttribution: function ()
   {
     Components.utils.import("resource:///modules/translation/Translation.jsm");
     Translation.openProviderAttribution();
   },
 
   toggleDoNotDisturbNotifications: function (event)
   {
-    AlertsServiceDND.manualDoNotDisturb = event.target.checked;
+    var isEnabled = event.target.checked;
+    AlertsServiceDND.manualDoNotDisturb = isEnabled;
+
+    Services.telemetry.getHistogramById(
+      "NOTIFICATION_DO_NOT_DISTURB_ENABLED").add(isEnabled);
   },
 };
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -10068,10 +10068,17 @@
   },
   "NOTIFICATION_PERMISSION_REMOVED": {
     "alert_emails": ["firefox-dev@mozilla.org"],
     "expires_in_version": "48",
     "kind": "enumerated",
     "n_values": 5,
     "releaseChannelCollection": "opt-out",
     "description": "Number of removed notification permissions (0 = remove deny, 1 = remove allow)."
+  },
+  "NOTIFICATION_EXCEPTIONS_OPENED": {
+    "alert_emails": ["firefox-dev@mozilla.org"],
+    "expires_in_version": "48",
+    "kind": "count",
+    "releaseChannelCollection": "opt-out",
+    "description": "Number of times a user opens the notification permissions dialog."
   }
 }