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-folder-node', | 6 is: 'bookmarks-folder-node', |
7 | 7 |
8 behaviors: [ | 8 behaviors: [ |
9 bookmarks.StoreClient, | 9 bookmarks.StoreClient, |
10 ], | 10 ], |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 /** @private */ | 32 /** @private */ |
33 isSelectedFolder_: { | 33 isSelectedFolder_: { |
34 type: Boolean, | 34 type: Boolean, |
35 value: false, | 35 value: false, |
36 reflectToAttribute: true, | 36 reflectToAttribute: true, |
37 computed: 'computeIsSelected_(itemId, selectedFolder_)' | 37 computed: 'computeIsSelected_(itemId, selectedFolder_)' |
38 }, | 38 }, |
39 }, | 39 }, |
40 | 40 |
| 41 /** @override */ |
41 attached: function() { | 42 attached: function() { |
42 this.watch('item_', function(state) { | 43 this.watch('item_', function(state) { |
43 return state.nodes[this.itemId]; | 44 return state.nodes[this.itemId]; |
44 }.bind(this)); | 45 }.bind(this)); |
45 this.watch('isClosed_', function(state) { | 46 this.watch('isClosed_', function(state) { |
46 return !!state.closedFolders[this.itemId]; | 47 return !!state.closedFolders[this.itemId]; |
47 }.bind(this)); | 48 }.bind(this)); |
48 this.watch('selectedFolder_', function(state) { | 49 this.watch('selectedFolder_', function(state) { |
49 return state.selectedFolder; | 50 return state.selectedFolder; |
50 }); | 51 }); |
51 | 52 |
52 this.updateFromStore(); | 53 this.updateFromStore(); |
53 }, | 54 }, |
54 | 55 |
| 56 /** @return {HTMLElement} */ |
| 57 getDropTarget: function() { |
| 58 return this.$.container; |
| 59 }, |
| 60 |
55 /** | 61 /** |
56 * @private | 62 * @private |
57 * @return {string} | 63 * @return {string} |
58 */ | 64 */ |
59 getFolderIcon_: function() { | 65 getFolderIcon_: function() { |
60 return this.isSelectedFolder_ ? 'bookmarks:folder-open' : 'cr:folder'; | 66 return this.isSelectedFolder_ ? 'bookmarks:folder-open' : 'cr:folder'; |
61 }, | 67 }, |
62 | 68 |
63 /** @private */ | 69 /** @private */ |
64 selectFolder_: function() { | 70 selectFolder_: function() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return this.depth + 1; | 117 return this.depth + 1; |
112 }, | 118 }, |
113 | 119 |
114 /** | 120 /** |
115 * @param {string} itemId | 121 * @param {string} itemId |
116 * @private | 122 * @private |
117 * @return {boolean} | 123 * @return {boolean} |
118 */ | 124 */ |
119 isFolder_: function(itemId) { | 125 isFolder_: function(itemId) { |
120 return !this.getState().nodes[itemId].url; | 126 return !this.getState().nodes[itemId].url; |
121 } | 127 }, |
| 128 |
| 129 /** |
| 130 * @private |
| 131 * @return {boolean} |
| 132 */ |
| 133 isRootFolder_: function() { |
| 134 return this.depth == 0; |
| 135 }, |
122 }); | 136 }); |
OLD | NEW |