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

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: add test, add grouped history 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 8b02ad7e7faddc2becec25ad34cfb8c7ecc1e377..bcce7222572cf93b74c99ad506bcfbbe07c76e0f 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 */
@@ -228,7 +229,7 @@ Polymer({
/** @type {HistorySyncedDeviceManagerElement} */this
.$$('history-synced-device-manager');
if (syncedDeviceManagerElem)
- syncedDeviceManagerElem.updateSignInState(isUserSignedIn);
+ syncedDeviceManagerElem.signInState = isUserSignedIn;
},
/**
@@ -266,6 +267,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));
},
/**
@@ -288,4 +295,36 @@ Polymer({
if (drawer)
drawer.close();
},
+
+ /** @private */
+ recordHistoryView_: function() {
+ var histogramValue = HistoryViewHistogram.END;
+ switch (this.$.content.selectedItem.id) {
+ 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;
+ }
tsergeant 2016/08/15 07:05:17 Nit: deindent to line up with switch
calamity 2016/08/17 03:15:28 Done.
+ 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