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

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

Issue 2186073003: [MD History] Close delete items dialog when a new query is initiated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@open_tabs_new_window
Patch Set: 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,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 var queryState = this.queryState; 58 var queryState = this.queryState;
59 // Disable querying until the first set of results have been returned. If 59 // Disable querying until the first set of results have been returned. If
60 // there is a search, query immediately to support search query params from 60 // there is a search, query immediately to support search query params from
61 // the URL. 61 // the URL.
62 var noResults = !this.queryResult || this.queryResult.results == null; 62 var noResults = !this.queryResult || this.queryResult.results == null;
63 if (queryState.queryingDisabled || 63 if (queryState.queryingDisabled ||
64 (!this.queryState.searchTerm && noResults)) { 64 (!this.queryState.searchTerm && noResults)) {
65 return; 65 return;
66 } 66 }
67 67
68 // Close any open dialog if a new query is initiated.
69 if (!incremental)
70 this.$.dialog.close();
71
68 this.set('queryState.querying', true); 72 this.set('queryState.querying', true);
69 this.set('queryState.incremental', incremental); 73 this.set('queryState.incremental', incremental);
70 74
71
72 var lastVisitTime = 0; 75 var lastVisitTime = 0;
73 if (incremental) { 76 if (incremental) {
74 var lastVisit = this.queryResult.results.slice(-1)[0]; 77 var lastVisit = this.queryResult.results.slice(-1)[0];
75 lastVisitTime = lastVisit ? lastVisit.time : 0; 78 lastVisitTime = lastVisit ? lastVisit.time : 0;
76 } 79 }
77 80
78 var maxResults = 81 var maxResults =
79 queryState.range == HistoryRange.ALL_TIME ? RESULTS_PER_PAGE : 0; 82 queryState.range == HistoryRange.ALL_TIME ? RESULTS_PER_PAGE : 0;
80 chrome.send('queryHistory', [ 83 chrome.send('queryHistory', [
81 queryState.searchTerm, queryState.groupedOffset, queryState.range, 84 queryState.searchTerm, queryState.groupedOffset, queryState.range,
(...skipping 24 matching lines...) Expand all
106 groupedRangeChanged_: function(range) { 109 groupedRangeChanged_: function(range) {
107 this.selectedPage_ = this.queryState.range == HistoryRange.ALL_TIME ? 110 this.selectedPage_ = this.queryState.range == HistoryRange.ALL_TIME ?
108 'infinite-list' : 'grouped-list'; 111 'infinite-list' : 'grouped-list';
109 112
110 this.queryHistory(false); 113 this.queryHistory(false);
111 }, 114 },
112 115
113 /** @private */ 116 /** @private */
114 loadMoreHistory_: function() { this.queryHistory(true); }, 117 loadMoreHistory_: function() { this.queryHistory(true); },
115 118
116
117 /** 119 /**
118 * @param {HistoryQuery} info 120 * @param {HistoryQuery} info
119 * @param {!Array<HistoryEntry>} results 121 * @param {!Array<HistoryEntry>} results
120 * @private 122 * @private
121 */ 123 */
122 initializeResults_: function(info, results) { 124 initializeResults_: function(info, results) {
123 if (results.length == 0) 125 if (results.length == 0)
124 return; 126 return;
125 127
126 var currentDate = results[0].dateRelativeDay; 128 var currentDate = results[0].dateRelativeDay;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 .then(function(items) { 185 .then(function(items) {
184 this.$['infinite-list'].removeDeletedHistory_(items); 186 this.$['infinite-list'].removeDeletedHistory_(items);
185 // This unselect-all is to reset the toolbar when deleting a selected 187 // This unselect-all is to reset the toolbar when deleting a selected
186 // item. TODO(tsergeant): Make this automatic based on observing list 188 // item. TODO(tsergeant): Make this automatic based on observing list
187 // modifications. 189 // modifications.
188 this.fire('unselect-all'); 190 this.fire('unselect-all');
189 }.bind(this)); 191 }.bind(this));
190 menu.closeMenu(); 192 menu.closeMenu();
191 }, 193 },
192 }); 194 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698