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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 * or decreases its count of selected items accordingly. | 35 * or decreases its count of selected items accordingly. |
36 * @private | 36 * @private |
37 */ | 37 */ |
38 onCheckboxSelected_: function() { | 38 onCheckboxSelected_: function() { |
39 this.fire('history-checkbox-select', { | 39 this.fire('history-checkbox-select', { |
40 countAddition: this.$.checkbox.checked ? 1 : -1 | 40 countAddition: this.$.checkbox.checked ? 1 : -1 |
41 }); | 41 }); |
42 }, | 42 }, |
43 | 43 |
44 /** | 44 /** |
| 45 * Remove bookmark of current item when bookmark-star is clicked. |
| 46 * @private |
| 47 */ |
| 48 onRemoveBookmarkTap_: function() { |
| 49 md_history.BrowserService.getInstance() |
| 50 .removeBookmark(this.item.url); |
| 51 this.fire('remove-bookmark-stars', this.item.url); |
| 52 }, |
| 53 |
| 54 /** |
45 * Fires a custom event when the menu button is clicked. Sends the details | 55 * Fires a custom event when the menu button is clicked. Sends the details |
46 * of the history item and where the menu should appear. | 56 * of the history item and where the menu should appear. |
47 */ | 57 */ |
48 onMenuButtonTap_: function(e) { | 58 onMenuButtonTap_: function(e) { |
49 this.fire('toggle-menu', { | 59 this.fire('toggle-menu', { |
50 target: Polymer.dom(e).localTarget, | 60 target: Polymer.dom(e).localTarget, |
51 item: this.item, | 61 item: this.item, |
52 }); | 62 }); |
53 | 63 |
54 // Stops the 'tap' event from closing the menu when it opens. | 64 // Stops the 'tap' event from closing the menu when it opens. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 124 |
115 if (searchedTerm) | 125 if (searchedTerm) |
116 return currentItem.dateShort != nextItem.dateShort; | 126 return currentItem.dateShort != nextItem.dateShort; |
117 | 127 |
118 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && | 128 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && |
119 currentItem.dateRelativeDay == nextItem.dateRelativeDay; | 129 currentItem.dateRelativeDay == nextItem.dateRelativeDay; |
120 }; | 130 }; |
121 | 131 |
122 return { HistoryItem: HistoryItem }; | 132 return { HistoryItem: HistoryItem }; |
123 }); | 133 }); |
OLD | NEW |