| Index: chrome/browser/resources/md_history/app.crisper.js
|
| diff --git a/chrome/browser/resources/md_history/app.crisper.js b/chrome/browser/resources/md_history/app.crisper.js
|
| index d5cf2641e84c50007c9b09394c66aa7301cb2def..d9c70b5df3bed688349b6c353b73f9ff59e50748 100644
|
| --- a/chrome/browser/resources/md_history/app.crisper.js
|
| +++ b/chrome/browser/resources/md_history/app.crisper.js
|
| @@ -11439,6 +11439,15 @@ cr.define('md_history', function() {
|
| },
|
|
|
| /**
|
| + * @param {string} histogram
|
| + * @param {number} value
|
| + * @param {number} max
|
| + */
|
| + recordHistogram: function(histogram, value, max) {
|
| + chrome.send('metricsHandler:recordInHistogram', [histogram, value, max]);
|
| + },
|
| +
|
| + /**
|
| * Record an action in UMA.
|
| * @param {string} actionDesc The name of the action to be logged.
|
| */
|
| @@ -14353,6 +14362,9 @@ Polymer({
|
| // Whether domain-grouped history is enabled.
|
| grouped: Boolean,
|
|
|
| + /** @type {HistoryRange} */
|
| + groupedRange: {type: Number, observer: 'groupedRangeChanged_'},
|
| +
|
| /** @type {!QueryState} */
|
| queryState: Object,
|
|
|
| @@ -14360,10 +14372,6 @@ Polymer({
|
| queryResult: Object,
|
| },
|
|
|
| - observers: [
|
| - 'groupedRangeChanged_(queryState.range)',
|
| - ],
|
| -
|
| listeners: {
|
| 'history-list-scrolled': 'closeMenu_',
|
| 'load-more-history': 'loadMoreHistory_',
|
| @@ -14421,7 +14429,7 @@ Polymer({
|
| }
|
|
|
| var maxResults =
|
| - queryState.range == HistoryRange.ALL_TIME ? RESULTS_PER_PAGE : 0;
|
| + this.groupedRange == HistoryRange.ALL_TIME ? RESULTS_PER_PAGE : 0;
|
| chrome.send('queryHistory', [
|
| queryState.searchTerm, queryState.groupedOffset, queryState.range,
|
| lastVisitTime, maxResults
|
| @@ -14454,11 +14462,15 @@ Polymer({
|
| * @param {HistoryRange} range
|
| * @private
|
| */
|
| - groupedRangeChanged_: function(range) {
|
| - this.selectedPage_ = this.queryState.range == HistoryRange.ALL_TIME ?
|
| + groupedRangeChanged_: function(range, oldRange) {
|
| + this.selectedPage_ = range == HistoryRange.ALL_TIME ?
|
| 'infinite-list' : 'grouped-list';
|
|
|
| + if (oldRange == undefined)
|
| + return;
|
| +
|
| this.queryHistory(false);
|
| + this.fire('history-view-changed');
|
| },
|
|
|
| /** @private */
|
| @@ -14702,9 +14714,11 @@ Polymer({
|
| },
|
|
|
| /** @private */
|
| - signInState_: {
|
| + signInState: {
|
| type: Boolean,
|
| + // Updated on attach by chrome.sending 'otherDevicesInitialized'.
|
| value: loadTimeData.getBoolean('isUserSignedIn'),
|
| + observer: 'signInStateChanged_',
|
| },
|
|
|
| /** @private */
|
| @@ -14890,18 +14904,13 @@ Polymer({
|
| * Get called when user's sign in state changes, this will affect UI of synced
|
| * tabs page. Sign in promo gets displayed when user is signed out, and
|
| * different messages are shown when there are no synced tabs.
|
| - * @param {boolean} isUserSignedIn
|
| + * @param {boolean} signInState
|
| */
|
| - updateSignInState: function(isUserSignedIn) {
|
| - // If user's sign in state didn't change, then don't change message or
|
| - // update UI.
|
| - if (this.signInState_ == isUserSignedIn)
|
| - return;
|
| -
|
| - this.signInState_ = isUserSignedIn;
|
| + signInStateChanged_: function(signInState) {
|
| + this.fire('history-view-changed');
|
|
|
| // User signed out, clear synced device list and show the sign in promo.
|
| - if (!isUserSignedIn) {
|
| + if (!signInState) {
|
| this.clearDisplayedSyncedDevices_();
|
| return;
|
| }
|
| @@ -14993,26 +15002,20 @@ Polymer({
|
| is: 'history-side-bar',
|
|
|
| properties: {
|
| - selectedPage: {
|
| - type: String,
|
| - notify: true
|
| - },
|
| + selectedPage: {type: String, notify: true},
|
|
|
| route: Object,
|
|
|
| showFooter: Boolean,
|
|
|
| // If true, the sidebar is contained within an app-drawer.
|
| - drawer: {
|
| - type: Boolean,
|
| - reflectToAttribute: true
|
| - },
|
| + drawer: {type: Boolean, reflectToAttribute: true},
|
| },
|
|
|
| - /** @private */
|
| - onSelectorActivate_: function() {
|
| - this.fire('history-close-drawer');
|
| - },
|
| + /**
|
| + * @private
|
| + */
|
| + onSelectorActivate_: function() { this.fire('history-close-drawer'); },
|
|
|
| /**
|
| * Relocates the user to the clear browsing data section of the settings page.
|
| @@ -15020,6 +15023,8 @@ Polymer({
|
| * @private
|
| */
|
| onClearBrowsingDataTap_: function(e) {
|
| + md_history.BrowserService.getInstance().recordAction(
|
| + 'HistoryPage_InitClearBrowsingData');
|
| md_history.BrowserService.getInstance().openClearBrowsingData();
|
| e.preventDefault();
|
| },
|
| @@ -15028,9 +15033,7 @@ Polymer({
|
| * @param {Object} route
|
| * @private
|
| */
|
| - getQueryString_: function(route) {
|
| - return window.location.search;
|
| - }
|
| + getQueryString_: function(route) { return window.location.search; }
|
| });
|
| // Copyright 2016 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| @@ -15043,7 +15046,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},
|
| @@ -15110,6 +15113,7 @@ Polymer({
|
| 'delete-selected': 'deleteSelected',
|
| 'search-domain': 'searchDomain_',
|
| 'history-close-drawer': 'closeDrawer_',
|
| + 'history-view-changed': 'recordHistoryView_',
|
| },
|
|
|
| /** @override */
|
| @@ -15263,7 +15267,7 @@ Polymer({
|
| /** @type {HistorySyncedDeviceManagerElement} */this
|
| .$$('history-synced-device-manager');
|
| if (syncedDeviceManagerElem)
|
| - syncedDeviceManagerElem.updateSignInState(isUserSignedIn);
|
| + syncedDeviceManagerElem.signInState = isUserSignedIn;
|
| },
|
|
|
| /**
|
| @@ -15301,6 +15305,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));
|
| },
|
|
|
| /**
|
| @@ -15323,4 +15333,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;
|
| + }
|
| + 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
|
| + );
|
| + },
|
| });
|
|
|