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

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: fix_test 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 historyDeleted: function() { 89 historyDeleted: function() {
91 // Do not reload the list when there are items checked. 90 // Do not reload the list when there are items checked.
92 if (this.getSelectedItemCount() > 0) 91 if (this.getSelectedItemCount() > 0)
93 return; 92 return;
(...skipping 22 matching lines...) Expand all
116 return; 115 return;
117 this.$.dialog.get().then(function(dialog) { 116 this.$.dialog.get().then(function(dialog) {
118 dialog.showModal(); 117 dialog.showModal();
119 }); 118 });
120 }, 119 },
121 120
122 /** 121 /**
123 * @param {HistoryRange} range 122 * @param {HistoryRange} range
124 * @private 123 * @private
125 */ 124 */
126 groupedRangeChanged_: function(range) { 125 groupedRangeChanged_: function(range, oldRange) {
127 this.selectedPage_ = this.queryState.range == HistoryRange.ALL_TIME ? 126 this.selectedPage_ = range == HistoryRange.ALL_TIME ?
128 'infinite-list' : 'grouped-list'; 127 'infinite-list' : 'grouped-list';
129 128
129 if (oldRange == undefined)
130 return;
131
130 this.queryHistory(false); 132 this.queryHistory(false);
133 this.fire('history-view-changed');
131 }, 134 },
132 135
133 /** @private */ 136 /** @private */
134 loadMoreHistory_: function() { this.queryHistory(true); }, 137 loadMoreHistory_: function() { this.queryHistory(true); },
135 138
136 /** 139 /**
137 * @param {HistoryQuery} info 140 * @param {HistoryQuery} info
138 * @param {!Array<HistoryEntry>} results 141 * @param {!Array<HistoryEntry>} results
139 * @private 142 * @private
140 */ 143 */
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 }, 221 },
219 222
220 /** 223 /**
221 * @return {HTMLElement} 224 * @return {HTMLElement}
222 * @private 225 * @private
223 */ 226 */
224 getSelectedList_: function() { 227 getSelectedList_: function() {
225 return this.$.content.selectedItem; 228 return this.$.content.selectedItem;
226 }, 229 },
227 }); 230 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/list_container.html ('k') | chrome/browser/resources/md_history/side_bar.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698