diff --git a/browser/metro/base/content/appbar.js b/browser/metro/base/content/appbar.js index e4629ed41963..d0b89160d1e0 100644 --- a/browser/metro/base/content/appbar.js +++ b/browser/metro/base/content/appbar.js @@ -25,6 +25,14 @@ var Appbar = { // tilegroup selection events for all modules get bubbled up window.addEventListener("selectionchange", this, false); + + // gather appbar telemetry data + try { + UITelemetry.addSimpleMeasureFunction("metro-appbar", + this.getAppbarMeasures.bind(this)); + } catch (ex) { + // swallow exception that occurs if metro-appbar measure is already set up + } }, handleEvent: function Appbar_handleEvent(aEvent) { @@ -149,6 +157,7 @@ var Appbar = { getService(Components.interfaces.nsIAppStartup); Services.prefs.setBoolPref('browser.sessionstore.resume_session_once', true); + this._incrementCountableEvent("switch-to-desktop-button"); appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit | Components.interfaces.nsIAppStartup.eRestart); }, @@ -273,6 +282,22 @@ var Appbar = { } }, + // track certain appbar events and interactions for the UITelemetry probe + _countableEvents: {}, + + _incrementCountableEvent: function(aName) { + if (!(aName in this._countableEvents)) { + this._countableEvents[aName] = 0; + } + this._countableEvents[aName]++; + }, + + getAppbarMeasures: function() { + return { + countableEvents: this._countableEvents + }; + }, + _updatePinButton: function() { this.pinButton.checked = Browser.isSitePinned(); }, @@ -282,4 +307,5 @@ var Appbar = { this.starButton.checked = isStarred; }.bind(this)); }, + }; diff --git a/browser/metro/base/content/browser-scripts.js b/browser/metro/base/content/browser-scripts.js index bbbdc3f42c9f..0e1290326adf 100644 --- a/browser/metro/base/content/browser-scripts.js +++ b/browser/metro/base/content/browser-scripts.js @@ -54,6 +54,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task", XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry", + "resource://gre/modules/UITelemetry.jsm"); /* * Services */