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

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

Issue 1993613002: [MD History] Implement grouped history UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@privatize
Patch Set: address comments 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 c6d424c7bcdf00a413a1eda2301865ff6fd2ba35..9b431d9dcfb3947a4bbad5958810914d85080b96 100644
--- a/chrome/browser/resources/md_history/history_list.js
+++ b/chrome/browser/resources/md_history/history_list.js
@@ -86,6 +86,7 @@ Polymer({
* @param {!Array<!HistoryEntry>} historyResults The new history results.
*/
addNewResults: function(historyResults) {
+ var results = historyResults.slice();
/** @type {IronScrollThresholdElement} */(this.$['scroll-threshold'])
.clearTriggers();
@@ -96,27 +97,6 @@ Polymer({
this.lastSearchedTerm_ = this.searchedTerm;
}
- if (historyResults.length == 0)
- return;
-
- // Creates a copy of historyResults to prevent accidentally modifying this
- // field.
- var results = historyResults.slice();
-
- var currentDate = results[0].dateRelativeDay;
-
- for (var i = 0; i < results.length; i++) {
- // Sets the default values for these fields to prevent undefined types.
- results[i].selected = false;
- results[i].readableTimestamp =
- this.searchedTerm == '' ?
- results[i].dateTimeOfDay : results[i].dateShort;
-
- if (results[i].dateRelativeDay != currentDate) {
- currentDate = results[i].dateRelativeDay;
- }
- }
-
if (this.historyData_) {
// If we have previously received data, push the new items onto the
// existing array.
@@ -217,17 +197,8 @@ Polymer({
* @private
*/
needsTimeGap_: function(item, index, length) {
- if (index >= length - 1 || length == 0)
- return false;
-
- var currentItem = this.historyData_[index];
- var nextItem = this.historyData_[index + 1];
-
- if (this.searchedTerm)
- return currentItem.dateShort != nextItem.dateShort;
-
- return currentItem.time - nextItem.time > BROWSING_GAP_TIME &&
- currentItem.dateRelativeDay == nextItem.dateRelativeDay;
+ return md_history.HistoryItem.needsTimeGap(
+ this.historyData_, index, this.searchedTerm);
},
hasResults: function(historyDataLength) {
« no previous file with comments | « chrome/browser/resources/md_history/history_list.html ('k') | chrome/browser/resources/md_history/history_toolbar.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698