| 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..7fabc08dcc78428df63d931d90a32038f6ef07a7 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,9 @@ Polymer({
|
| },
|
|
|
| /** @private */
|
| - signInState_: {
|
| + signInState: {
|
| type: Boolean,
|
| - value: loadTimeData.getBoolean('isUserSignedIn'),
|
| + observer: 'signInStateChanged_',
|
| },
|
|
|
| /** @private */
|
| @@ -14890,18 +14902,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() {
|
| + this.fire('history-view-changed');
|
|
|
| // User signed out, clear synced device list and show the sign in promo.
|
| - if (!isUserSignedIn) {
|
| + if (!this.signInState) {
|
| this.clearDisplayedSyncedDevices_();
|
| return;
|
| }
|
| @@ -14993,26 +15000,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 +15021,8 @@ Polymer({
|
| * @private
|
| */
|
| onClearBrowsingDataTap_: function(e) {
|
| + md_history.BrowserService.getInstance().recordAction(
|
| + 'HistoryPage_InitClearBrowsingData');
|
| md_history.BrowserService.getInstance().openClearBrowsingData();
|
| e.preventDefault();
|
| },
|
| @@ -15028,9 +15031,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 +15044,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},
|
| @@ -15069,7 +15070,7 @@ Polymer({
|
| }
|
| },
|
|
|
| - /** @type {!QueryResult} */
|
| + /** @type {!QueryResult} */
|
| queryResult_: {
|
| type: Object,
|
| value: function() {
|
| @@ -15089,6 +15090,13 @@ Polymer({
|
|
|
| // True if the window is narrow enough for the page to have a drawer.
|
| hasDrawer: Boolean,
|
| +
|
| + isUserSignedIn_: {
|
| + type: Boolean,
|
| + // Updated on synced-device-manager attach by chrome.sending
|
| + // 'otherDevicesInitialized'.
|
| + value: loadTimeData.getBoolean('isUserSignedIn'),
|
| + },
|
| },
|
|
|
| observers: [
|
| @@ -15110,6 +15118,7 @@ Polymer({
|
| 'delete-selected': 'deleteSelected',
|
| 'search-domain': 'searchDomain_',
|
| 'history-close-drawer': 'closeDrawer_',
|
| + 'history-view-changed': 'recordHistoryView_',
|
| },
|
|
|
| /** @override */
|
| @@ -15158,9 +15167,7 @@ Polymer({
|
| toolbar.count = 0;
|
| },
|
|
|
| - deleteSelected: function() {
|
| - this.$.history.deleteSelectedWithPrompt();
|
| - },
|
| + deleteSelected: function() { this.$.history.deleteSelectedWithPrompt(); },
|
|
|
| /**
|
| * @param {HistoryQuery} info An object containing information about the
|
| @@ -15179,9 +15186,7 @@ Polymer({
|
| /**
|
| * Focuses the search bar in the toolbar.
|
| */
|
| - focusToolbarSearchField: function() {
|
| - this.$.toolbar.showSearchField();
|
| - },
|
| + focusToolbarSearchField: function() { this.$.toolbar.showSearchField(); },
|
|
|
| /**
|
| * Fired when the user presses 'More from this site'.
|
| @@ -15259,11 +15264,7 @@ Polymer({
|
| * @param {boolean} isUserSignedIn
|
| */
|
| updateSignInState: function(isUserSignedIn) {
|
| - var syncedDeviceManagerElem =
|
| - /** @type {HistorySyncedDeviceManagerElement} */this
|
| - .$$('history-synced-device-manager');
|
| - if (syncedDeviceManagerElem)
|
| - syncedDeviceManagerElem.updateSignInState(isUserSignedIn);
|
| + this.isUserSignedIn_ = isUserSignedIn;
|
| },
|
|
|
| /**
|
| @@ -15291,9 +15292,7 @@ Polymer({
|
| * @param {string} page
|
| * @private
|
| */
|
| - routeDataChanged_: function(page) {
|
| - this.selectedPage_ = page;
|
| - },
|
| + routeDataChanged_: function(page) { this.selectedPage_ = page; },
|
|
|
| /**
|
| * @param {string} selectedPage
|
| @@ -15301,6 +15300,7 @@ Polymer({
|
| */
|
| selectedPageChanged_: function(selectedPage) {
|
| this.set('routeData_.page', selectedPage);
|
| + this.recordHistoryView_();
|
| },
|
|
|
| /**
|
| @@ -15313,9 +15313,7 @@ Polymer({
|
| * @return {string}
|
| * @private
|
| */
|
| - getSelectedPage_: function(selectedPage, items) {
|
| - return selectedPage;
|
| - },
|
| + getSelectedPage_: function(selectedPage, items) { return selectedPage; },
|
|
|
| /** @private */
|
| closeDrawer_: function() {
|
| @@ -15323,4 +15321,33 @@ Polymer({
|
| if (drawer)
|
| drawer.close();
|
| },
|
| +
|
| + /** @private */
|
| + recordHistoryView_: function() {
|
| + var histogramValue = HistoryViewHistogram.END;
|
| + switch (this.selectedPage_) {
|
| + case 'syncedTabs':
|
| + histogramValue = this.isUserSignedIn_ ?
|
| + HistoryViewHistogram.SYNCED_TABS :
|
| + HistoryViewHistogram.SIGNIN_PROMO;
|
| + break;
|
| + default:
|
| + 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;
|
| + }
|
| +
|
| + md_history.BrowserService.getInstance().recordHistogram(
|
| + 'History.HistoryView', histogramValue, HistoryViewHistogram.END
|
| + );
|
| + },
|
| });
|
|
|