Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3410)

Unified Diff: chrome/browser/resources/local_discovery/local_discovery.js

Issue 23508003: Added UMA actions to devices page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/local_discovery/local_discovery.js
diff --git a/chrome/browser/resources/local_discovery/local_discovery.js b/chrome/browser/resources/local_discovery/local_discovery.js
index 6ff4865f9fffb2eb7274cbc37cbc6a892f14b774..1a6ade371dba2bef6d6cf19fffcefdf6dc0ca977 100644
--- a/chrome/browser/resources/local_discovery/local_discovery.js
+++ b/chrome/browser/resources/local_discovery/local_discovery.js
@@ -86,6 +86,7 @@ cr.define('local_discovery', function() {
* Register the device.
*/
register: function() {
+ recordUmaAction('DevicesPage_RegisterClicked');
chrome.send('registerDevice', [this.info.service_name]);
setRegisterPage('register-page-adding1');
}
@@ -142,9 +143,10 @@ cr.define('local_discovery', function() {
}
/**
- * Hide the register overlay.
+ * Show the register overlay.
*/
function showRegisterOverlay() {
+ recordUmaAction('DevicesPage_AddPrintersClicked');
$('register-overlay').classList.add('showing');
$('overlay').hidden = false;
uber.invokeMethodOnParent('beginInterceptingEvents');
@@ -152,13 +154,12 @@ cr.define('local_discovery', function() {
}
/**
- * Show the register overlay.
+ * Hide the register overlay.
*/
function hideRegisterOverlay() {
$('register-overlay').classList.remove('showing');
$('overlay').hidden = true;
uber.invokeMethodOnParent('stopInterceptingEvents');
- chrome.send('cancelRegistration');
}
/**
@@ -176,6 +177,7 @@ cr.define('local_discovery', function() {
*/
function onRegistrationFailed() {
setRegisterPage('register-page-error');
+ recordUmaAction('DevicesPage_RegisterFailure');
}
/**
@@ -268,6 +270,7 @@ cr.define('local_discovery', function() {
function onRegistrationSuccess() {
hideRegisterOverlay();
requestPrinterList();
+ recordUmaAction('DevicesPage_RegisterSuccess');
}
/**
@@ -305,25 +308,42 @@ cr.define('local_discovery', function() {
* @param {string} device_id ID of device.
*/
function manageCloudDevice(device_id) {
+ recordUmaAction('DevicesPage_ManageClicked');
chrome.send('openCloudPrintURL',
[PRINTER_MANAGEMENT_PAGE_PREFIX + device_id]);
}
+ /**
+ * Record an action in UMA.
+ * @param {string} actionDesc The name of the action to be logged.
+ */
+ function recordUmaAction(actionDesc) {
+ chrome.send('metricsHandler:recordAction', [actionDesc]);
+ }
+
+ /**
+ * Cancel the registration.
+ */
+ function cancelRegistration() {
+ hideRegisterOverlay();
+ chrome.send('cancelRegistration');
+ recordUmaAction('DevicesPage_RegisterCancel');
+ }
document.addEventListener('DOMContentLoaded', function() {
uber.onContentFrameLoaded();
cr.ui.overlay.setupOverlay($('overlay'));
cr.ui.overlay.globalInitialization();
- $('overlay').addEventListener('cancelOverlay', hideRegisterOverlay);
+ $('overlay').addEventListener('cancelOverlay', cancelRegistration);
var cancelButtons = document.querySelectorAll('.register-cancel');
var cancelButtonsLength = cancelButtons.length;
for (var i = 0; i < cancelButtonsLength; i++) {
- cancelButtons[i].addEventListener('click', hideRegisterOverlay);
+ cancelButtons[i].addEventListener('click', cancelRegistration);
}
- $('register-error-exit').addEventListener('click', hideRegisterOverlay);
+ $('register-error-exit').addEventListener('click', cancelRegistration);
$('add-printers-button').addEventListener('click',
showRegisterOverlay);
@@ -336,6 +356,7 @@ cr.define('local_discovery', function() {
uber.invokeMethodOnParent('setTitle', {title: title});
chrome.send('start');
+ recordUmaAction('DevicesPage_Opened');
requestPrinterList();
});
« no previous file with comments | « no previous file | chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698