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

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: consider search term 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 properties: { 8 properties: {
9 // The search term for the current query. Set when the query returns. 9 // The search term for the current query. Set when the query returns.
10 searchedTerm: { 10 searchedTerm: {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 if (this.lastSearchedTerm_ != this.searchedTerm) { 75 if (this.lastSearchedTerm_ != this.searchedTerm) {
76 this.resultLoadingDisabled_ = false; 76 this.resultLoadingDisabled_ = false;
77 if (this.historyData_) 77 if (this.historyData_)
78 this.splice('historyData_', 0, this.historyData_.length); 78 this.splice('historyData_', 0, this.historyData_.length);
79 this.fire('unselect-all'); 79 this.fire('unselect-all');
80 this.lastSearchedTerm_ = this.searchedTerm; 80 this.lastSearchedTerm_ = this.searchedTerm;
81 } 81 }
82 82
83 if (this.historyData_) { 83 if (this.historyData_) {
84 // If we have previously received data, push the new items onto the 84 // If we have previously received data, refresh the list unless the user
85 // existing array. 85 // has any items checked.
86 results.unshift('historyData_'); 86 var selectedItem = this.historyData_.filter(function(item) {
87 this.push.apply(this, results); 87 return item.selected;
lshang 2016/08/04 00:17:04 These two lines seem not right. When there are ne
tsergeant 2016/08/04 01:25:55 These lines support infinite scrolling. When we do
lshang 2016/08/05 03:39:03 Ah, it's for infinite scrolling! Then it makes sen
88 });
89 if (selectedItem.length == 0) {
90 this.splice('historyData_', 0, this.historyData_.length);
91 this.set('historyData_', results);
92 }
88 } else { 93 } else {
89 // The first time we receive data, use set() to ensure the iron-list is 94 // The first time we receive data, use set() to ensure the iron-list is
90 // initialized correctly. 95 // initialized correctly.
91 this.set('historyData_', results); 96 this.set('historyData_', results);
92 } 97 }
93 }, 98 },
94 99
95 /** 100 /**
96 * Cycle through each entry in historyData_ and set all items to be 101 * Cycle through each entry in historyData_ and set all items to be
97 * unselected. 102 * unselected.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 return index == 0; 243 return index == 0;
239 }, 244 },
240 245
241 /** 246 /**
242 * @private 247 * @private
243 */ 248 */
244 notifyListScroll_: function() { 249 notifyListScroll_: function() {
245 this.fire('history-list-scrolled'); 250 this.fire('history-list-scrolled');
246 }, 251 },
247 }); 252 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698