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..499aa9dc1e11b5231ea2696afd35db752eb43851 100644 |
| --- a/chrome/browser/resources/md_history/history_card.js |
| +++ b/chrome/browser/resources/md_history/history_card.js |
| @@ -7,7 +7,7 @@ Polymer({ |
| properties: { |
| // The date of these history items. |
|
tsergeant
2016/02/08 22:59:01
Update this comment
hsampson
2016/02/09 02:17:51
Done.
|
| - historyDate: { |
| + historyTitle: { |
| type: String, |
| value: '' |
| }, |
| @@ -17,6 +17,11 @@ Polymer({ |
| historyItems: { |
| type: Array, |
| value: function() { return []; } |
| + }, |
| + |
| + searchTerm: { |
| + type: String, |
| + value: '' |
| } |
| }, |
| @@ -24,12 +29,37 @@ 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) { |
| + 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; |
| + } |
| + }, |
| + |
| + /** |
| + * 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. |
| + * @param {string} historyTitle The title of this card. |
| + * @private |
| + */ |
| + cardTitle_: function(numberOfItems, search, historyTitle) { |
| + var resultId = numberOfItems == 1 ? 'searchResult' : 'searchResults'; |
| + |
| + if (search == '' || search == undefined) |
| + return historyTitle; |
| + else |
| + return loadTimeData.getStringF('foundSearchResults', numberOfItems, |
| + loadTimeData.getString(resultId), search); |
| } |
| }); |