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

Unified 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: address review comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_history/history_list.js
diff --git a/chrome/browser/resources/md_history/history_list.js b/chrome/browser/resources/md_history/history_list.js
index aaba6536622c5929aba6360e9ff38e4a8f659dfc..30c56aca28317562606f471a48f56f27abc09cfa 100644
--- a/chrome/browser/resources/md_history/history_list.js
+++ b/chrome/browser/resources/md_history/history_list.js
@@ -16,6 +16,11 @@ Polymer({
querying: Boolean,
+ reloadingList_: {
+ type: Boolean,
+ value: false,
+ },
+
// An array of history entries in reverse chronological order.
historyData_: Array,
@@ -81,10 +86,23 @@ Polymer({
}
if (this.historyData_) {
- // If we have previously received data, push the new items onto the
- // existing array.
- results.unshift('historyData_');
- this.push.apply(this, results);
+ // Reload the list when browsing data is cleared.
+ if (this.reloadingList_) {
+ this.reloadingList_ = false;
+ // If we have previously received data, refresh the list unless the user
+ // has any items checked.
+ var selectedItem = this.historyData_.filter(function(item) {
tsergeant 2016/08/08 05:05:12 Chris has a CL in review which makes it much easie
+ return item.selected;
+ });
+ if (selectedItem.length == 0) {
+ this.splice('historyData_', 0, this.historyData_.length);
+ this.set('historyData_', results);
+ }
+ } else {
+ // Infinite scrolling. Push the new items onto the existing array.
+ results.unshift('historyData_');
+ this.push.apply(this, results);
+ }
} else {
// The first time we receive data, use set() to ensure the iron-list is
// initialized correctly.
@@ -92,6 +110,10 @@ Polymer({
}
},
+ reloadingList: function() {
+ this.reloadingList_ = true;
+ },
+
/**
* Cycle through each entry in historyData_ and set all items to be
* unselected.
« 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