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

Side by Side Diff: chrome/browser/resources/md_history/list_container.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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer({ 5 Polymer({
6 is: 'history-list-container', 6 is: 'history-list-container',
7 7
8 properties: { 8 properties: {
9 // The path of the currently selected page. 9 // The path of the currently selected page.
10 selectedPage_: String, 10 selectedPage_: String,
11 11
12 // Whether domain-grouped history is enabled. 12 // Whether domain-grouped history is enabled.
13 grouped: Boolean, 13 grouped: Boolean,
14 14
15 /** @type {HistoryRange} */
16 groupedRange: {type: Number, observer: 'groupedRangeChanged_'},
17
15 /** @type {!QueryState} */ 18 /** @type {!QueryState} */
16 queryState: Object, 19 queryState: Object,
17 20
18 /** @type {!QueryResult} */ 21 /** @type {!QueryResult} */
19 queryResult: Object, 22 queryResult: Object,
20 }, 23 },
21 24
22 observers: [
23 'groupedRangeChanged_(queryState.range)',
24 ],
25
26 listeners: { 25 listeners: {
27 'history-list-scrolled': 'closeMenu_', 26 'history-list-scrolled': 'closeMenu_',
28 'load-more-history': 'loadMoreHistory_', 27 'load-more-history': 'loadMoreHistory_',
29 'toggle-menu': 'toggleMenu_', 28 'toggle-menu': 'toggleMenu_',
30 }, 29 },
31 30
32 /** 31 /**
33 * @param {HistoryQuery} info An object containing information about the 32 * @param {HistoryQuery} info An object containing information about the
34 * query. 33 * query.
35 * @param {!Array<HistoryEntry>} results A list of results. 34 * @param {!Array<HistoryEntry>} results A list of results.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 this.set('queryState.querying', true); 72 this.set('queryState.querying', true);
74 this.set('queryState.incremental', incremental); 73 this.set('queryState.incremental', incremental);
75 74
76 var lastVisitTime = 0; 75 var lastVisitTime = 0;
77 if (incremental) { 76 if (incremental) {
78 var lastVisit = this.queryResult.results.slice(-1)[0]; 77 var lastVisit = this.queryResult.results.slice(-1)[0];
79 lastVisitTime = lastVisit ? lastVisit.time : 0; 78 lastVisitTime = lastVisit ? lastVisit.time : 0;
80 } 79 }
81 80
82 var maxResults = 81 var maxResults =
83 queryState.range == HistoryRange.ALL_TIME ? RESULTS_PER_PAGE : 0; 82 this.groupedRange == HistoryRange.ALL_TIME ? RESULTS_PER_PAGE : 0;
84 chrome.send('queryHistory', [ 83 chrome.send('queryHistory', [
85 queryState.searchTerm, queryState.groupedOffset, queryState.range, 84 queryState.searchTerm, queryState.groupedOffset, queryState.range,
86 lastVisitTime, maxResults 85 lastVisitTime, maxResults
87 ]); 86 ]);
88 }, 87 },
89 88
90 /** @return {number} */ 89 /** @return {number} */
91 getSelectedItemCount: function() { 90 getSelectedItemCount: function() {
92 return this.getSelectedList_().selectedPaths.size; 91 return this.getSelectedList_().selectedPaths.size;
93 }, 92 },
(...skipping 12 matching lines...) Expand all
106 return; 105 return;
107 this.$.dialog.get().then(function(dialog) { 106 this.$.dialog.get().then(function(dialog) {
108 dialog.showModal(); 107 dialog.showModal();
109 }); 108 });
110 }, 109 },
111 110
112 /** 111 /**
113 * @param {HistoryRange} range 112 * @param {HistoryRange} range
114 * @private 113 * @private
115 */ 114 */
116 groupedRangeChanged_: function(range) { 115 groupedRangeChanged_: function(range, oldRange) {
117 this.selectedPage_ = this.queryState.range == HistoryRange.ALL_TIME ? 116 this.selectedPage_ = range == HistoryRange.ALL_TIME ?
118 'infinite-list' : 'grouped-list'; 117 'infinite-list' : 'grouped-list';
119 118
119 if (oldRange == undefined)
120 return;
121
120 this.queryHistory(false); 122 this.queryHistory(false);
123 this.fire('history-view-changed');
121 }, 124 },
122 125
123 /** @private */ 126 /** @private */
124 loadMoreHistory_: function() { this.queryHistory(true); }, 127 loadMoreHistory_: function() { this.queryHistory(true); },
125 128
126 /** 129 /**
127 * @param {HistoryQuery} info 130 * @param {HistoryQuery} info
128 * @param {!Array<HistoryEntry>} results 131 * @param {!Array<HistoryEntry>} results
129 * @private 132 * @private
130 */ 133 */
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 }, 211 },
209 212
210 /** 213 /**
211 * @return {HTMLElement} 214 * @return {HTMLElement}
212 * @private 215 * @private
213 */ 216 */
214 getSelectedList_: function() { 217 getSelectedList_: function() {
215 return this.$.content.selectedItem; 218 return this.$.content.selectedItem;
216 }, 219 },
217 }); 220 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698