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

Side by Side Diff: chrome/browser/resources/md_history/list_container.js

Issue 2068613002: [MD History] Add URL parameter for search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@routing
Patch Set: remove_var Created 4 years, 5 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 {!QueryState} */ 15 /** @type {!QueryState} */
16 queryState: Object, 16 queryState: Object,
17 17
18 /** @type {!QueryResult} */ 18 /** @type {!QueryResult} */
19 queryResult: Object, 19 queryResult: Object,
20 }, 20 },
21 21
22 observers: [ 22 observers: [
23 'searchTermChanged_(queryState.searchTerm)',
24 'groupedRangeChanged_(queryState.range)', 23 'groupedRangeChanged_(queryState.range)',
25 ], 24 ],
26 25
27 listeners: { 26 listeners: {
28 'load-more-history': 'loadMoreHistory_', 27 'load-more-history': 'loadMoreHistory_',
29 }, 28 },
30 29
31 /** 30 /**
32 * @param {HistoryQuery} info An object containing information about the 31 * @param {HistoryQuery} info An object containing information about the
33 * query. 32 * query.
(...skipping 13 matching lines...) Expand all
47 list.disableResultLoading(); 46 list.disableResultLoading();
48 }, 47 },
49 48
50 /** 49 /**
51 * Queries the history backend for results based on queryState. 50 * Queries the history backend for results based on queryState.
52 * @param {boolean} incremental Whether the new query should continue where 51 * @param {boolean} incremental Whether the new query should continue where
53 * the previous query stopped. 52 * the previous query stopped.
54 */ 53 */
55 queryHistory: function(incremental) { 54 queryHistory: function(incremental) {
56 var queryState = this.queryState; 55 var queryState = this.queryState;
57 // Disable querying until the first set of results have been returned. 56 // Disable querying until the first set of results have been returned. If
58 if (!this.queryResult || this.queryResult.results == null || 57 // there is a search, query immediately to support search query params from
59 queryState.queryingDisabled) { 58 // the URL.
59 var noResults = !this.queryResult || this.queryResult.results == null;
60 if (queryState.queryingDisabled ||
61 (!this.queryState.searchTerm && noResults)) {
60 return; 62 return;
61 } 63 }
62 64
63 this.set('queryState.querying', true); 65 this.set('queryState.querying', true);
64 this.set('queryState.incremental', incremental); 66 this.set('queryState.incremental', incremental);
65 67
66 68
67 var lastVisitTime = 0; 69 var lastVisitTime = 0;
68 if (incremental) { 70 if (incremental) {
69 var lastVisit = this.queryResult.results.slice(-1)[0]; 71 var lastVisit = this.queryResult.results.slice(-1)[0];
(...skipping 18 matching lines...) Expand all
88 * a dialog to confirm that the deletion should be performed. 90 * a dialog to confirm that the deletion should be performed.
89 */ 91 */
90 deleteSelectedWithPrompt: function() { 92 deleteSelectedWithPrompt: function() {
91 if (!loadTimeData.getBoolean('allowDeletingHistory')) 93 if (!loadTimeData.getBoolean('allowDeletingHistory'))
92 return; 94 return;
93 95
94 this.$.dialog.open(); 96 this.$.dialog.open();
95 }, 97 },
96 98
97 /** 99 /**
98 * @param {string} searchTerm
99 * @private
100 */
101 searchTermChanged_: function(searchTerm) { this.queryHistory(false); },
102
103 /**
104 * @param {HistoryRange} range 100 * @param {HistoryRange} range
105 * @private 101 * @private
106 */ 102 */
107 groupedRangeChanged_: function(range) { 103 groupedRangeChanged_: function(range) {
108 this.selectedPage_ = this.queryState.range == HistoryRange.ALL_TIME ? 104 this.selectedPage_ = this.queryState.range == HistoryRange.ALL_TIME ?
109 'infinite-list' : 'grouped-list'; 105 'infinite-list' : 'grouped-list';
110 106
111 this.queryHistory(false); 107 this.queryHistory(false);
112 }, 108 },
113 109
(...skipping 28 matching lines...) Expand all
142 onDialogConfirmTap_: function() { 138 onDialogConfirmTap_: function() {
143 this.$['infinite-list'].deleteSelected(); 139 this.$['infinite-list'].deleteSelected();
144 this.$.dialog.close(); 140 this.$.dialog.close();
145 }, 141 },
146 142
147 /** @private */ 143 /** @private */
148 onDialogCancelTap_: function() { 144 onDialogCancelTap_: function() {
149 this.$.dialog.close(); 145 this.$.dialog.close();
150 } 146 }
151 }); 147 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/app.js ('k') | chrome/browser/resources/md_history/side_bar.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698