Chromium Code Reviews| 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 06332cb1961d6b636fdcf677e6a4d3ded4e2f8ea..64eb93e389a0949758cc5cb1bb90098f0b46e672 100644 |
| --- a/chrome/browser/resources/md_history/history_card.js |
| +++ b/chrome/browser/resources/md_history/history_card.js |
| @@ -17,6 +17,11 @@ Polymer({ |
| historyItems: { |
| type: Array, |
| value: function() { return []; } |
| + }, |
| + |
| + searchTerm: { |
| + type: String, |
| + value: '' |
| } |
| }, |
| @@ -24,12 +29,39 @@ Polymer({ |
| * Check whether the time difference between the given historyItem and the |
| * next one is large enough for a spacer to be required. |
| * @param {number} index The index number of the first item being compared. |
| + * @param {!HistoryEntry} historyItem The first item being compared. |
| + * @param {string} search The search term associated with this item. |
| * @return {boolean} Whether or not time gap separator is required. |
| * @private |
| */ |
| - needsTimeGap_: function(index) { |
| + needsTimeGap_: function(index, historyItem, search) { |
| var items = this.historyItems; |
| - return index + 1 < items.length && |
| + |
| + if ((search == '') || (search == undefined)) { |
|
calamity
2016/02/05 02:30:10
(((Too) (many) parens))!
hsampson
2016/02/08 04:40:23
Done.
|
| + return index + 1 < items.length && |
| items[index].time - items[index + 1].time > BROWSING_GAP_TIME; |
| + } else { |
| + return index + 1 < items.length && |
| + items[index].dateTimeOfDay != items[index + 1].dateTimeOfDay; |
| + } |
| + }, |
| + |
| + /** |
| + * Create the title for the history-card holding all the results. |
| + * @param {number} numberOfItems The number of items in the card. |
| + * @param {string} search The search term associated with these results. |
| + * @param {string} historyDate The day this card corresponds to if these |
| + * results are part of a normal history search. |
| + * @private |
| + */ |
| + searchResultTitle_: function(numberOfItems, search, historyDate) { |
|
calamity
2016/02/05 02:30:10
This should be called something like 'cardTitle_'
hsampson
2016/02/08 04:40:23
Done.
|
| + var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults'; |
| + |
| + if (search == '') { |
|
tsergeant
2016/02/04 02:28:49
Nit: Remove {}
Also use a ternary expression if y
hsampson
2016/02/08 04:40:23
Done.
|
| + return historyDate; |
| + } else { |
| + return loadTimeData.getStringF('foundSearchResults', numberOfItems, |
| + loadTimeData.getString(resultId), search); |
| + } |
| } |
| }); |