| 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 // True if the website is a bookmarked page. | |
| 15 starred: {type: Boolean, reflectToAttribute: true}, | |
| 16 | |
| 17 // Search term used to obtain this history-item. | 14 // Search term used to obtain this history-item. |
| 18 searchTerm: {type: String}, | 15 searchTerm: {type: String}, |
| 19 | 16 |
| 20 selected: {type: Boolean, notify: true}, | 17 selected: {type: Boolean, notify: true}, |
| 21 | 18 |
| 22 isFirstItem: {type: Boolean, reflectToAttribute: true}, | 19 isFirstItem: {type: Boolean, reflectToAttribute: true}, |
| 23 | 20 |
| 24 isCardStart: {type: Boolean, reflectToAttribute: true}, | 21 isCardStart: {type: Boolean, reflectToAttribute: true}, |
| 25 | 22 |
| 26 isCardEnd: {type: Boolean, reflectToAttribute: true}, | 23 isCardEnd: {type: Boolean, reflectToAttribute: true}, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 this.fire('history-checkbox-select', { | 40 this.fire('history-checkbox-select', { |
| 44 countAddition: this.$.checkbox.checked ? 1 : -1 | 41 countAddition: this.$.checkbox.checked ? 1 : -1 |
| 45 }); | 42 }); |
| 46 }, | 43 }, |
| 47 | 44 |
| 48 /** | 45 /** |
| 49 * Remove bookmark of current item when bookmark-star is clicked. | 46 * Remove bookmark of current item when bookmark-star is clicked. |
| 50 * @private | 47 * @private |
| 51 */ | 48 */ |
| 52 onRemoveBookmarkTap_: function() { | 49 onRemoveBookmarkTap_: function() { |
| 53 if (this.$['bookmark-star'] == this.root.activeElement) | 50 if (!this.item.starred) |
| 51 return; |
| 52 |
| 53 if (this.$$('#bookmark-star') == this.root.activeElement) |
| 54 this.$['menu-button'].focus(); | 54 this.$['menu-button'].focus(); |
| 55 | 55 |
| 56 md_history.BrowserService.getInstance() | 56 md_history.BrowserService.getInstance() |
| 57 .removeBookmark(this.item.url); | 57 .removeBookmark(this.item.url); |
| 58 this.fire('remove-bookmark-stars', this.item.url); | 58 this.fire('remove-bookmark-stars', this.item.url); |
| 59 }, | 59 }, |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Fires a custom event when the menu button is clicked. Sends the details | 62 * Fires a custom event when the menu button is clicked. Sends the details |
| 63 * of the history item and where the menu should appear. | 63 * of the history item and where the menu should appear. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 131 |
| 132 if (searchedTerm) | 132 if (searchedTerm) |
| 133 return currentItem.dateShort != nextItem.dateShort; | 133 return currentItem.dateShort != nextItem.dateShort; |
| 134 | 134 |
| 135 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && | 135 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && |
| 136 currentItem.dateRelativeDay == nextItem.dateRelativeDay; | 136 currentItem.dateRelativeDay == nextItem.dateRelativeDay; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 return { HistoryItem: HistoryItem }; | 139 return { HistoryItem: HistoryItem }; |
| 140 }); | 140 }); |
| OLD | NEW |