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

Unified Diff: chrome/browser/resources/md_history/app.js

Issue 2238163002: [MD History] Add UMA stats for switching views and the CBD button. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@start_focus_in_search_bar
Patch Set: rebase, vulcanize Created 4 years, 4 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
Index: chrome/browser/resources/md_history/app.js
diff --git a/chrome/browser/resources/md_history/app.js b/chrome/browser/resources/md_history/app.js
index 4864f53a324ba2e72c44d2f7a96466da82f81573..790c53e1f8895fcce24b5915f07f759011a89392 100644
--- a/chrome/browser/resources/md_history/app.js
+++ b/chrome/browser/resources/md_history/app.js
@@ -9,7 +9,7 @@ Polymer({
showSidebarFooter: Boolean,
// The id of the currently selected page.
- selectedPage_: {type: String, value: 'history', observer: 'unselectAll'},
+ selectedPage_: {type: String, observer: 'unselectAll'},
// Whether domain-grouped history is enabled.
grouped_: {type: Boolean, reflectToAttribute: true},
@@ -76,6 +76,7 @@ Polymer({
'delete-selected': 'deleteSelected',
'search-domain': 'searchDomain_',
'history-close-drawer': 'closeDrawer_',
+ 'history-view-changed': 'recordHistoryView_',
},
/** @override */
@@ -229,7 +230,7 @@ Polymer({
/** @type {HistorySyncedDeviceManagerElement} */this
.$$('history-synced-device-manager');
if (syncedDeviceManagerElem)
- syncedDeviceManagerElem.updateSignInState(isUserSignedIn);
+ syncedDeviceManagerElem.signInState = isUserSignedIn;
},
/**
@@ -267,6 +268,12 @@ Polymer({
*/
selectedPageChanged_: function(selectedPage) {
this.set('routeData_.page', selectedPage);
+
+ // Log the current view on the next animation frame to allow the iron-pages
+ // to detect that the synced-device-manager has been rendered.
+ requestAnimationFrame(function() {
+ this.recordHistoryView_();
+ }.bind(this));
},
/**
@@ -289,4 +296,36 @@ Polymer({
if (drawer)
drawer.close();
},
+
+ /** @private */
+ recordHistoryView_: function() {
+ var histogramValue = HistoryViewHistogram.END;
+ switch (this.$.content.selectedItem.id) {
tsergeant 2016/08/17 06:03:09 Why not just use this.selectedPage here? Then ther
calamity 2016/08/18 03:11:15 Done. Normalizing sounds... annoying and subtle. I
+ case 'history':
+ switch (this.queryState_.range) {
+ case HistoryRange.ALL_TIME:
+ histogramValue = HistoryViewHistogram.HISTORY;
+ break;
+ case HistoryRange.WEEK:
+ histogramValue = HistoryViewHistogram.GROUPED_WEEK;
+ break;
+ case HistoryRange.MONTH:
+ histogramValue = HistoryViewHistogram.GROUPED_MONTH;
+ break;
+ }
+ break;
+ case 'synced-devices':
+ var syncedDeviceManager =
+ /** @type {HistorySyncedDeviceManagerElement} */ this.$.content
+ .selectedItem;
+ histogramValue = syncedDeviceManager.signInState ?
+ HistoryViewHistogram.SYNCED_TABS :
+ HistoryViewHistogram.SIGNIN_PROMO;
+ break;
+ }
+
+ md_history.BrowserService.getInstance().recordHistogram(
+ 'History.HistoryView', histogramValue, HistoryViewHistogram.END
+ );
+ },
});

Powered by Google App Engine
This is Rietveld 408576698