OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('md_history', function() { | 5 cr.define('md_history', function() { |
6 var HistoryItem = Polymer({ | 6 var HistoryItem = Polymer({ |
7 is: 'history-item', | 7 is: 'history-item', |
8 | 8 |
9 properties: { | 9 properties: { |
10 // Underlying HistoryEntry data for this item. Contains read-only fields | 10 // Underlying HistoryEntry data for this item. Contains read-only fields |
11 // from the history backend, as well as fields computed by history-list. | 11 // from the history backend, as well as fields computed by history-list. |
12 item: {type: Object, observer: 'showIcon_'}, | 12 item: {type: Object, observer: 'showIcon_'}, |
13 | 13 |
14 // Search term used to obtain this history-item. | 14 // Search term used to obtain this history-item. |
15 searchTerm: {type: String}, | 15 searchTerm: {type: String}, |
16 | 16 |
17 selected: {type: Boolean, notify: true}, | 17 selected: {type: Boolean, reflectToAttribute: true}, |
18 | 18 |
19 isFirstItem: {type: Boolean, reflectToAttribute: true}, | 19 isFirstItem: {type: Boolean, reflectToAttribute: true}, |
20 | 20 |
21 isCardStart: {type: Boolean, reflectToAttribute: true}, | 21 isCardStart: {type: Boolean, reflectToAttribute: true}, |
22 | 22 |
23 isCardEnd: {type: Boolean, reflectToAttribute: true}, | 23 isCardEnd: {type: Boolean, reflectToAttribute: true}, |
24 | 24 |
25 // True if the item is being displayed embedded in another element and | 25 // True if the item is being displayed embedded in another element and |
26 // should not manage its own borders or size. | 26 // should not manage its own borders or size. |
27 embedded: {type: Boolean, reflectToAttribute: true}, | 27 embedded: {type: Boolean, reflectToAttribute: true}, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 */ | 67 */ |
68 getEntrySummary_: function() { | 68 getEntrySummary_: function() { |
69 var item = this.item; | 69 var item = this.item; |
70 return loadTimeData.getStringF( | 70 return loadTimeData.getStringF( |
71 'entrySummary', item.dateTimeOfDay, | 71 'entrySummary', item.dateTimeOfDay, |
72 item.starred ? loadTimeData.getString('bookmarked') : '', item.title, | 72 item.starred ? loadTimeData.getString('bookmarked') : '', item.title, |
73 item.domain); | 73 item.domain); |
74 }, | 74 }, |
75 | 75 |
76 /** | 76 /** |
| 77 * @param {boolean} selected |
| 78 * @return {string} |
| 79 * @private |
| 80 */ |
| 81 getAriaChecked_: function(selected) { |
| 82 return selected ? 'true' : 'false'; |
| 83 }, |
| 84 |
| 85 /** |
77 * Remove bookmark of current item when bookmark-star is clicked. | 86 * Remove bookmark of current item when bookmark-star is clicked. |
78 * @private | 87 * @private |
79 */ | 88 */ |
80 onRemoveBookmarkTap_: function() { | 89 onRemoveBookmarkTap_: function() { |
81 if (!this.item.starred) | 90 if (!this.item.starred) |
82 return; | 91 return; |
83 | 92 |
84 if (this.$$('#bookmark-star') == this.root.activeElement) | 93 if (this.$$('#bookmark-star') == this.root.activeElement) |
85 this.$['menu-button'].focus(); | 94 this.$['menu-button'].focus(); |
86 | 95 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 191 |
183 if (searchedTerm) | 192 if (searchedTerm) |
184 return currentItem.dateShort != nextItem.dateShort; | 193 return currentItem.dateShort != nextItem.dateShort; |
185 | 194 |
186 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && | 195 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && |
187 currentItem.dateRelativeDay == nextItem.dateRelativeDay; | 196 currentItem.dateRelativeDay == nextItem.dateRelativeDay; |
188 }; | 197 }; |
189 | 198 |
190 return { HistoryItem: HistoryItem }; | 199 return { HistoryItem: HistoryItem }; |
191 }); | 200 }); |
OLD | NEW |