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

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

Issue 1643693003: MD History: Implement search functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch_to_be_uploaded
Patch Set: Hide cards that haven't been rerendered from previous chrome.send(). Created 4 years, 11 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_card.js
diff --git a/chrome/browser/resources/md_history/history_card.js b/chrome/browser/resources/md_history/history_card.js
index 542a6d9ecd8a8645bbd1ffc474d9d8b5d10d2510..826bebe5ff07270659c24cce6344f80fe63f3c53 100644
--- a/chrome/browser/resources/md_history/history_card.js
+++ b/chrome/browser/resources/md_history/history_card.js
@@ -11,11 +11,17 @@ Polymer({
type: String,
value: ''
},
+
// The list of history results that were accessed for a particular day in
// reverse chronological order.
historyItems: {
type: Array,
value: function() { return []; }
+ },
+
+ searchTerm: {
+ type: String,
+ value: ''
}
},
@@ -30,5 +36,24 @@ Polymer({
var items = this.historyItems;
return index + 1 < items.length &&
items[index].time - items[index + 1].time > BROWSING_GAP_TIME;
+ },
+
+ /**
+ * Checks whether the results returned are part of a search.
+ * @private
+ */
+ isNotSearchResult_: function(search) {
+ return search == '';
+ },
+
+ /**
+ * Create the title for the history-card holding all the search results.
+ * Found <numberOfItems> search result(s) for '<search>'.
+ * @private
+ */
+ searchResultTitle_: function(numberOfItems, search) {
+ var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults';
+ return loadTimeData.getStringF('foundSearchResults', numberOfItems,
+ loadTimeData.getString(resultId), search);
}
});

Powered by Google App Engine
This is Rietveld 408576698