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

Unified Diff: chrome/browser/resources/md_history/app.crisper.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: fix test and vulcanize 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/app.crisper.js
diff --git a/chrome/browser/resources/md_history/app.crisper.js b/chrome/browser/resources/md_history/app.crisper.js
index 3e75862e14094e32974a703a7d4959977c019372..6ccfcb46ace5134093697b92749f9dc3bc2e06ed 100644
--- a/chrome/browser/resources/md_history/app.crisper.js
+++ b/chrome/browser/resources/md_history/app.crisper.js
@@ -14084,6 +14084,11 @@ Polymer({
querying: Boolean,
+ clearingHistory_: {
+ type: Boolean,
+ value: false,
+ },
+
// An array of history entries in reverse chronological order.
historyData_: Array,
@@ -14136,13 +14141,24 @@ Polymer({
* Adds the newly updated history results into historyData_. Adds new fields
* for each result.
* @param {!Array<!HistoryEntry>} historyResults The new history results.
+ * @param {boolean} incremental Whether the result is from loading more
+ * history, or a new search/list reload.
+ * @param {number} selectedCount Number of selected items.
*/
- addNewResults: function(historyResults) {
+ addNewResults: function(historyResults, incremental, selectedCount) {
var results = historyResults.slice();
/** @type {IronScrollThresholdElement} */(this.$['scroll-threshold'])
.clearTriggers();
- if (this.lastSearchedTerm_ != this.searchedTerm) {
+ // Do not reload the list when clearing browsing data and there are items
+ // checked.
+ if (this.clearingHistory_) {
+ this.clearingHistory_ = false;
+ if (selectedCount > 0)
+ return;
+ }
+
+ if (!incremental) {
this.resultLoadingDisabled_ = false;
if (this.historyData_)
this.splice('historyData_', 0, this.historyData_.length);
@@ -14162,6 +14178,10 @@ Polymer({
}
},
+ clearingHistory: function() {
+ this.clearingHistory_ = true;
+ },
+
/**
* Called when the page is scrolled to near the bottom of the list.
* @private
@@ -14385,7 +14405,8 @@ Polymer({
}
var list = /** @type {HistoryListElement} */(this.$['infinite-list']);
- list.addNewResults(results);
+ list.addNewResults(results, this.queryState.incremental,
+ this.getSelectedItemCount());
if (info.finished)
list.disableResultLoading();
},
@@ -14428,6 +14449,11 @@ Polymer({
]);
},
+ clearingHistory: function() {
+ /** @type {HistoryListElement} */ (this.$['infinite-list'])
+ .clearingHistory();
+ },
+
/** @return {number} */
getSelectedItemCount: function() {
return this.getSelectedList_().selectedPaths.size;
@@ -15247,6 +15273,15 @@ Polymer({
},
/**
+ * Called when browsing data is cleared.
+ */
+ historyDeleted: function() {
+ this.$['history'].clearingHistory();
+ // Call into list-container to restore search state.
+ this.$['history'].queryHistory(false);
+ },
+
+ /**
* Update sign in state of synced device manager after user logs in or out.
* @param {boolean} isUserSignedIn
*/

Powered by Google App Engine
This is Rietveld 408576698