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

Unified Diff: chrome/browser/resources/md_history/history_list.js

Issue 1972073002: [MD History] Make history-list:historyData private. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_loading
Patch Set: Created 4 years, 7 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 37d6c5330a696db5d2de3deba300191397e39b36..b61986ab588766578b09a18109a37ab399fe2c3d 100644
--- a/chrome/browser/resources/md_history/history_list.js
+++ b/chrome/browser/resources/md_history/history_list.js
@@ -16,7 +16,7 @@ Polymer({
querying: Boolean,
// An array of history entries in reverse chronological order.
- historyData: Array,
+ historyData_: Array,
resultLoadingDisabled_: {
type: Boolean,
@@ -65,7 +65,7 @@ Polymer({
},
/**
- * Adds the newly updated history results into historyData. Adds new fields
+ * Adds the newly updated history results into historyData_. Adds new fields
* for each result.
* @param {!Array<!HistoryEntry>} historyResults The new history results.
*/
@@ -75,8 +75,8 @@ Polymer({
if (this.lastSearchedTerm_ != this.searchedTerm) {
this.resultLoadingDisabled_ = false;
- if (this.historyData)
- this.splice('historyData', 0, this.historyData.length);
+ if (this.historyData_)
+ this.splice('historyData_', 0, this.historyData_.length);
this.lastSearchedTerm_ = this.searchedTerm;
}
@@ -101,30 +101,30 @@ Polymer({
}
}
- if (this.historyData) {
+ if (this.historyData_) {
// If we have previously received data, push the new items onto the
// existing array.
- results.unshift('historyData');
+ 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.
- this.set('historyData', results);
+ this.set('historyData_', results);
}
},
/**
- * Cycle through each entry in historyData and set all items to be
+ * Cycle through each entry in historyData_ and set all items to be
* unselected.
* @param {number} overallItemCount The number of checkboxes selected.
*/
unselectAllItems: function(overallItemCount) {
- if (this.historyData === undefined)
+ if (this.historyData_ === undefined)
return;
- for (var i = 0; i < this.historyData.length; i++) {
- if (this.historyData[i].selected) {
- this.set('historyData.' + i + '.selected', false);
+ for (var i = 0; i < this.historyData_.length; i++) {
+ if (this.historyData_[i].selected) {
+ this.set('historyData_.' + i + '.selected', false);
overallItemCount--;
if (overallItemCount == 0)
break;
@@ -140,20 +140,20 @@ Polymer({
*/
removeDeletedHistory: function(overallItemCount) {
var splices = [];
- for (var i = this.historyData.length - 1; i >= 0; i--) {
- if (!this.historyData[i].selected)
+ for (var i = this.historyData_.length - 1; i >= 0; i--) {
+ if (!this.historyData_[i].selected)
continue;
- // Removes the selected item from historyData. Use unshift so |splices|
+ // Removes the selected item from historyData_. Use unshift so |splices|
// ends up in index order.
splices.unshift({
index: i,
- removed: [this.historyData[i]],
+ removed: [this.historyData_[i]],
addedCount: 0,
- object: this.historyData,
+ object: this.historyData_,
type: 'splice'
});
- this.historyData.splice(i, 1);
+ this.historyData_.splice(i, 1);
overallItemCount--;
if (overallItemCount == 0)
@@ -161,7 +161,7 @@ Polymer({
}
// notifySplices gives better performance than individually splicing as it
// batches all of the updates together.
- this.notifySplices('historyData', splices);
+ this.notifySplices('historyData_', splices);
},
/**
@@ -173,11 +173,11 @@ Polymer({
*/
getSelectedItems: function(count) {
var toBeRemoved = [];
- for (var i = 0; i < this.historyData.length; i++) {
- if (this.historyData[i].selected) {
+ for (var i = 0; i < this.historyData_.length; i++) {
+ if (this.historyData_[i].selected) {
toBeRemoved.push({
- url: this.historyData[i].url,
- timestamps: this.historyData[i].allTimestamps
+ url: this.historyData_[i].url,
+ timestamps: this.historyData_[i].allTimestamps
});
count--;
@@ -203,8 +203,8 @@ Polymer({
* Check whether the time difference between the given history item and the
* next one is large enough for a spacer to be required.
* @param {HistoryEntry} item
- * @param {number} index The index of |item| in |historyData|.
- * @param {number} length The length of |historyData|.
+ * @param {number} index The index of |item| in |historyData_|.
+ * @param {number} length The length of |historyData_|.
* @return {boolean} Whether or not time gap separator is required.
* @private
*/
@@ -212,8 +212,8 @@ Polymer({
if (index >= length - 1 || length == 0)
return false;
- var currentItem = this.historyData[index];
- var nextItem = this.historyData[index + 1];
+ var currentItem = this.historyData_[index];
+ var nextItem = this.historyData_[index + 1];
if (this.searchedTerm)
return currentItem.dateShort != nextItem.dateShort;
@@ -222,8 +222,8 @@ Polymer({
currentItem.dateRelativeDay == nextItem.dateRelativeDay;
},
- hasResults: function(historyDataLength) {
- return historyDataLength > 0;
+ hasResults: function(historyData_Length) {
tsergeant 2016/05/18 06:44:02 Nit: I would probably leave this one alone, it loo
calamity 2016/05/18 07:14:16 Fiiiiiine.
+ return historyData_Length > 0;
},
noResultsMessage_: function(searchedTerm, isLoading) {
@@ -236,7 +236,7 @@ Polymer({
/**
* True if the given item is the beginning of a new card.
* @param {HistoryEntry} item
- * @param {number} i Index of |item| within |historyData|.
+ * @param {number} i Index of |item| within |historyData_|.
* @param {number} length
* @return {boolean}
* @private
@@ -245,14 +245,14 @@ Polymer({
if (length == 0 || i > length - 1)
return false;
return i == 0 ||
- this.historyData[i].dateRelativeDay !=
- this.historyData[i - 1].dateRelativeDay;
+ this.historyData_[i].dateRelativeDay !=
+ this.historyData_[i - 1].dateRelativeDay;
},
/**
* True if the given item is the end of a card.
* @param {HistoryEntry} item
- * @param {number} i Index of |item| within |historyData|.
+ * @param {number} i Index of |item| within |historyData_|.
* @param {number} length
* @return {boolean}
* @private
@@ -261,7 +261,7 @@ Polymer({
if (length == 0 || i > length - 1)
return false;
return i == length - 1 ||
- this.historyData[i].dateRelativeDay !=
- this.historyData[i + 1].dateRelativeDay;
+ this.historyData_[i].dateRelativeDay !=
+ this.historyData_[i + 1].dateRelativeDay;
},
});
« no previous file with comments | « chrome/browser/resources/md_history/history_list.html ('k') | chrome/test/data/webui/md_history/history_item_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698