OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 Polymer({ | 5 Polymer({ |
6 is: 'bookmarks-item', | 6 is: 'bookmarks-item', |
7 | 7 |
8 behaviors: [ | 8 behaviors: [ |
9 bookmarks.StoreClient, | 9 bookmarks.StoreClient, |
10 ], | 10 ], |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 observers: [ | 34 observers: [ |
35 'updateFavicon_(item_.url)', | 35 'updateFavicon_(item_.url)', |
36 ], | 36 ], |
37 | 37 |
38 listeners: { | 38 listeners: { |
39 'click': 'onClick_', | 39 'click': 'onClick_', |
40 'dblclick': 'onDblClick_', | 40 'dblclick': 'onDblClick_', |
41 }, | 41 }, |
42 | 42 |
| 43 /** @override */ |
43 attached: function() { | 44 attached: function() { |
44 this.watch('item_', function(store) { | 45 this.watch('item_', function(store) { |
45 return store.nodes[this.itemId]; | 46 return store.nodes[this.itemId]; |
46 }.bind(this)); | 47 }.bind(this)); |
47 this.watch('isSelectedItem_', function(store) { | 48 this.watch('isSelectedItem_', function(store) { |
48 return !!store.selection.items[this.itemId]; | 49 return !!store.selection.items[this.itemId]; |
49 }.bind(this)); | 50 }.bind(this)); |
50 | 51 |
51 this.updateFromStore(); | 52 this.updateFromStore(); |
52 }, | 53 }, |
53 | 54 |
| 55 /** @return {BookmarksItemElement} */ |
| 56 getDropTarget: function() { |
| 57 return this; |
| 58 }, |
| 59 |
54 /** | 60 /** |
55 * @param {Event} e | 61 * @param {Event} e |
56 * @private | 62 * @private |
57 */ | 63 */ |
58 onMenuButtonOpenClick_: function(e) { | 64 onMenuButtonOpenClick_: function(e) { |
59 e.stopPropagation(); | 65 e.stopPropagation(); |
60 this.fire('open-item-menu', { | 66 this.fire('open-item-menu', { |
61 target: e.target, | 67 target: e.target, |
62 item: this.item_, | 68 item: this.item_, |
63 }); | 69 }); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 }, | 103 }, |
98 | 104 |
99 /** | 105 /** |
100 * @param {string} url | 106 * @param {string} url |
101 * @private | 107 * @private |
102 */ | 108 */ |
103 updateFavicon_: function(url) { | 109 updateFavicon_: function(url) { |
104 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); | 110 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); |
105 }, | 111 }, |
106 }); | 112 }); |
OLD | NEW |