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

Unified Diff: chrome/browser/resources/print_preview/search/destination_search.js

Issue 10480002: Implements metrics for destination search. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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 | « chrome/browser/resources/print_preview/print_preview_utils.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview/search/destination_search.js
diff --git a/chrome/browser/resources/print_preview/search/destination_search.js b/chrome/browser/resources/print_preview/search/destination_search.js
index 05c2cee42c4446d03e9610f1b01979f8f0c7098c..332e9b11fb5062c247fc7e95cd63abca344f3b7f 100644
--- a/chrome/browser/resources/print_preview/search/destination_search.js
+++ b/chrome/browser/resources/print_preview/search/destination_search.js
@@ -14,10 +14,11 @@ cr.define('print_preview', function() {
* containing the destinations to search through.
* @param {!print_preview.UserInfo} userInfo Event target that contains
* information about the logged in user.
+ * @param {!print_preview.Metrics} metrics Used to record usage statistics.
* @constructor
* @extends {print_preview.Component}
*/
- function DestinationSearch(destinationStore, userInfo) {
+ function DestinationSearch(destinationStore, userInfo, metrics) {
print_preview.Component.call(this);
/**
@@ -35,6 +36,13 @@ cr.define('print_preview', function() {
this.userInfo_ = userInfo;
/**
+ * Used to record usage statistics.
+ * @type {!print_preview.Metrics}
+ * @private
+ */
+ this.metrics_ = metrics;
+
+ /**
* Search box used to search through the destination lists.
* @type {!print_preview.SearchBox}
* @private
@@ -136,6 +144,12 @@ cr.define('print_preview', function() {
this.searchBox_.focus();
this.getElement().classList.remove(
DestinationSearch.Classes_.TRANSPARENT);
+ var promoEl = this.getElement().getElementsByClassName(
+ DestinationSearch.Classes_.CLOUDPRINT_PROMO)[0];
+ if (getIsVisible(promoEl)) {
+ this.metrics_.increment(
+ print_preview.Metrics.Bucket.CLOUDPRINT_PROMO_SHOWN);
+ }
} else {
this.getElement().classList.add(DestinationSearch.Classes_.TRANSPARENT);
// Collapse all destination lists
@@ -167,6 +181,10 @@ cr.define('print_preview', function() {
var promoEl = this.getElement().getElementsByClassName(
DestinationSearch.Classes_.CLOUDPRINT_PROMO)[0];
setIsVisible(promoEl, true);
+ if (this.getIsVisible()) {
+ this.metrics_.increment(
+ print_preview.Metrics.Bucket.CLOUDPRINT_PROMO_SHOWN);
+ }
},
/** @override */
@@ -301,6 +319,8 @@ cr.define('print_preview', function() {
onCloseClick_: function() {
this.setIsVisible(false);
this.resetSearch_();
+ this.metrics_.increment(
+ print_preview.Metrics.Bucket.DESTINATION_SELECTION_CANCELED);
},
/**
@@ -313,6 +333,8 @@ cr.define('print_preview', function() {
this.setIsVisible(false);
this.resetSearch_();
this.destinationStore_.selectDestination(evt.destination);
+ this.metrics_.increment(
+ print_preview.Metrics.Bucket.DESTINATION_SELECTED);
},
/**
@@ -382,6 +404,7 @@ cr.define('print_preview', function() {
*/
onSignInActivated_: function() {
cr.dispatchSimpleEvent(this, DestinationSearch.EventType.SIGN_IN);
+ this.metrics_.increment(print_preview.Metrics.Bucket.SIGNIN_TRIGGERED);
},
/**
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview_utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698