Bug 944147 - Collect UITelemetry on bookmark star usage. r=Gijs, a=lsblakk.
authorMike Conley <mconley@mozilla.com>
Mon, 16 Dec 2013 11:45:53 -0500
changeset 167723 d7915b7643020df7903667900bcfe9a6f7b0f99f
parent 167722 4ebfdf4aa3311cbe86b7127f937bbe92904c276d
child 167724 84d1ee47e83c32af465d65ace1482424f551beef
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, lsblakk
bugs944147
milestone27.0
Bug 944147 - Collect UITelemetry on bookmark star usage. r=Gijs, a=lsblakk.
browser/modules/BrowserUITelemetry.jsm
--- a/browser/modules/BrowserUITelemetry.jsm
+++ b/browser/modules/BrowserUITelemetry.jsm
@@ -211,16 +211,17 @@ XPCOMUtils.defineLazyGetter(this, "ALL_B
   return DEFAULT_ITEMS.concat(PALETTE_ITEMS)
                       .concat(SPECIAL_CASES);
 });
 
 const OTHER_MOUSEUP_MONITORED_ITEMS = [
    "appmenu-button",
    "PlacesChevron",
    "PlacesToolbarItems",
+   "star-button",
 ];
 
 this.BrowserUITelemetry = {
   init: function() {
     UITelemetry.addSimpleMeasureFunction("toolbars",
                                          this.getToolbarMeasures.bind(this));
     Services.obs.addObserver(this, "browser-delayed-startup-finished", false);
   },
@@ -298,16 +299,19 @@ this.BrowserUITelemetry = {
         this._appmenuMouseUp(aEvent);
         break;
       case "PlacesToolbarItems":
         this._PlacesToolbarItemsMouseUp(aEvent);
         break;
       case "PlacesChevron":
         this._PlacesChevronMouseUp(aEvent);
         break;
+      case "star-button":
+        this._starButtonMouseUp(aEvent);
+        break;
       default:
         this._checkForBuiltinItem(aEvent);
     }
   },
 
   _appmenuMouseUp: function(aEvent) {
     let itemId;
 
@@ -369,16 +373,25 @@ this.BrowserUITelemetry = {
     // If not, we need to check if one of the ancestors of the clicked
     // item is in our list of built-in items to check.
     let candidate = getIDBasedOnFirstIDedAncestor(item, toolbarID);
     if (ALL_BUILTIN_ITEMS.indexOf(candidate) != -1) {
       this._countEvent("click-builtin-item", candidate);
     }
   },
 
+  _starButtonMouseUp: function(aEvent) {
+    let starButton = aEvent.originalTarget;
+    if (starButton.hasAttribute("starred")) {
+      this._countEvent("click-star-button", "edit");
+    } else {
+      this._countEvent("click-star-button", "add");
+    }
+  },
+
   countCustomizationEvent: function(aCustomizationEvent) {
     this._countEvent("customize", aCustomizationEvent);
   },
 
   getToolbarMeasures: function() {
     // Grab the most recent non-popup, non-private browser window for us to
     // analyze the toolbars in...
     let win = RecentWindow.getMostRecentBrowserWindow({