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 3df08cf81ea9b20f05a867ce4c35df020b12893a..c8c4c96548454956c3f80de3cc779eb5aa2c7cd1 100644 |
| --- a/chrome/browser/resources/md_history/history_card.js |
| +++ b/chrome/browser/resources/md_history/history_card.js |
| @@ -6,7 +6,7 @@ Polymer({ |
| is: 'history-card', |
| properties: { |
| - // The date of these history items. |
| + // The date associated with the history-card. |
| historyDate: { |
| type: String, |
| value: '' |
| @@ -17,6 +17,11 @@ Polymer({ |
| historyItems: { |
| type: Array, |
| value: function() { return []; } |
| + }, |
| + |
| + searchTerm: { |
| + type: String, |
| + value: '' |
| } |
| }, |
| @@ -26,12 +31,35 @@ Polymer({ |
| * @param {number} index The index number of the first item being compared. |
| * @param {number} itemsLength The number of items on the card. Used to force |
| * needsTimeGap_ to run for every item if an item is deleted from the card. |
| + * @param {string} search The search term associated with this item. |
| * @return {boolean} Whether or not time gap separator is required. |
| * @private |
| */ |
| - needsTimeGap_: function(index, itemsLength) { |
| + needsTimeGap_: function(index, itemsLength, search) { |
| var items = this.historyItems; |
| - return index + 1 < items.length && |
| + |
| + if (search == '' || search == undefined) { |
| + return index + 1 < items.length && |
| items[index].time - items[index + 1].time > BROWSING_GAP_TIME; |
| + } else { |
| + return index + 1 < items.length && |
| + items[index].visibleTimestamp != items[index + 1].visibleTimestamp; |
| + } |
| + }, |
| + |
| + /** |
| + * Generates the title for this history card. |
| + * @param {number} numberOfItems The number of items in the card. |
| + * @param {string} search The search term associated with these results. |
| + * @private |
| + */ |
| + cardTitle_: function(numberOfItems, search, historyDate) { |
| + var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults'; |
| + |
| + if (search == '' || search == undefined) { |
|
tsergeant
2016/02/12 00:03:52
Can search actually ever be undefined?
Can you do
hsampson
2016/02/12 06:45:43
No I don't think it can.
|
| + return historyDate; |
| + } else |
| + return loadTimeData.getStringF('foundSearchResults', numberOfItems, |
| + loadTimeData.getString(resultId), search); |
| } |
| }); |