зеркало из https://github.com/mozilla/gecko-dev.git
Bug 948139 - Use UITelemetry to capture clicks on the 'switch to desktop' appbar item. r=mbrubeck
This commit is contained in:
Родитель
3572f0ca45
Коммит
057494860b
|
@ -25,6 +25,14 @@ var Appbar = {
|
||||||
|
|
||||||
// tilegroup selection events for all modules get bubbled up
|
// tilegroup selection events for all modules get bubbled up
|
||||||
window.addEventListener("selectionchange", this, false);
|
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) {
|
handleEvent: function Appbar_handleEvent(aEvent) {
|
||||||
|
@ -149,6 +157,7 @@ var Appbar = {
|
||||||
getService(Components.interfaces.nsIAppStartup);
|
getService(Components.interfaces.nsIAppStartup);
|
||||||
|
|
||||||
Services.prefs.setBoolPref('browser.sessionstore.resume_session_once', true);
|
Services.prefs.setBoolPref('browser.sessionstore.resume_session_once', true);
|
||||||
|
this._incrementCountableEvent("switch-to-desktop-button");
|
||||||
appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
|
appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
|
||||||
Components.interfaces.nsIAppStartup.eRestart);
|
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() {
|
_updatePinButton: function() {
|
||||||
this.pinButton.checked = Browser.isSitePinned();
|
this.pinButton.checked = Browser.isSitePinned();
|
||||||
},
|
},
|
||||||
|
@ -282,4 +307,5 @@ var Appbar = {
|
||||||
this.starButton.checked = isStarred;
|
this.starButton.checked = isStarred;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,6 +54,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
||||||
"resource://gre/modules/osfile.jsm");
|
"resource://gre/modules/osfile.jsm");
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry",
|
||||||
|
"resource://gre/modules/UITelemetry.jsm");
|
||||||
/*
|
/*
|
||||||
* Services
|
* Services
|
||||||
*/
|
*/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче