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

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

Issue 2200233003: MD History: Refresh the list when clearing browsing data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revise 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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', 6 is: 'history-list',
7 7
8 behaviors: [HistoryListBehavior], 8 behaviors: [HistoryListBehavior],
9 9
10 properties: { 10 properties: {
11 // The search term for the current query. Set when the query returns. 11 // The search term for the current query. Set when the query returns.
12 searchedTerm: { 12 searchedTerm: {
13 type: String, 13 type: String,
14 value: '', 14 value: '',
15 }, 15 },
16 16
17 lastSearchedTerm_: String,
18
19 querying: Boolean, 17 querying: Boolean,
20 18
21 // An array of history entries in reverse chronological order. 19 // An array of history entries in reverse chronological order.
22 historyData_: Array, 20 historyData_: Array,
23 21
24 resultLoadingDisabled_: { 22 resultLoadingDisabled_: {
25 type: Boolean, 23 type: Boolean,
26 value: false, 24 value: false,
27 }, 25 },
28 }, 26 },
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 * Disables history result loading when there are no more history results. 61 * Disables history result loading when there are no more history results.
64 */ 62 */
65 disableResultLoading: function() { 63 disableResultLoading: function() {
66 this.resultLoadingDisabled_ = true; 64 this.resultLoadingDisabled_ = true;
67 }, 65 },
68 66
69 /** 67 /**
70 * Adds the newly updated history results into historyData_. Adds new fields 68 * Adds the newly updated history results into historyData_. Adds new fields
71 * for each result. 69 * for each result.
72 * @param {!Array<!HistoryEntry>} historyResults The new history results. 70 * @param {!Array<!HistoryEntry>} historyResults The new history results.
71 * @param {boolean} incremental Whether the result is from loading more
72 * history, or a new search/list reload.
73 */ 73 */
74 addNewResults: function(historyResults) { 74 addNewResults: function(historyResults, incremental) {
75 var results = historyResults.slice(); 75 var results = historyResults.slice();
76 /** @type {IronScrollThresholdElement} */(this.$['scroll-threshold']) 76 /** @type {IronScrollThresholdElement} */(this.$['scroll-threshold'])
77 .clearTriggers(); 77 .clearTriggers();
78 78
79 if (this.lastSearchedTerm_ != this.searchedTerm) { 79 if (!incremental) {
80 this.resultLoadingDisabled_ = false; 80 this.resultLoadingDisabled_ = false;
81 if (this.historyData_) 81 if (this.historyData_)
82 this.splice('historyData_', 0, this.historyData_.length); 82 this.splice('historyData_', 0, this.historyData_.length);
83 this.fire('unselect-all'); 83 this.fire('unselect-all');
84 this.lastSearchedTerm_ = this.searchedTerm;
85 } 84 }
86 85
87 if (this.historyData_) { 86 if (this.historyData_) {
88 // If we have previously received data, push the new items onto the 87 // If we have previously received data, push the new items onto the
89 // existing array. 88 // existing array.
90 results.unshift('historyData_'); 89 results.unshift('historyData_');
91 this.push.apply(this, results); 90 this.push.apply(this, results);
92 } else { 91 } else {
93 // The first time we receive data, use set() to ensure the iron-list is 92 // The first time we receive data, use set() to ensure the iron-list is
94 // initialized correctly. 93 // initialized correctly.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 170
172 /** 171 /**
173 * @param {number} index 172 * @param {number} index
174 * @return {string} 173 * @return {string}
175 * @private 174 * @private
176 */ 175 */
177 pathForItem_: function(index) { 176 pathForItem_: function(index) {
178 return 'historyData_.' + index; 177 return 'historyData_.' + index;
179 }, 178 },
180 }); 179 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/history.js ('k') | chrome/browser/resources/md_history/list_container.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698