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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 }, | 53 }, |
54 | 54 |
55 /** | 55 /** |
56 * @private | 56 * @private |
57 * @return {string} | 57 * @return {string} |
58 */ | 58 */ |
59 getFolderIcon_: function() { | 59 getFolderIcon_: function() { |
60 return this.isSelectedFolder_ ? 'bookmarks:folder-open' : 'cr:folder'; | 60 return this.isSelectedFolder_ ? 'bookmarks:folder-open' : 'cr:folder'; |
61 }, | 61 }, |
62 | 62 |
63 /** | |
64 * @private | |
65 * @return {string} | |
66 */ | |
67 getArrowIcon_: function() { | |
68 return this.isClosed_ ? 'cr:arrow-drop-down' : 'cr:arrow-drop-up'; | |
69 }, | |
70 | |
71 /** @private */ | 63 /** @private */ |
72 selectFolder_: function() { | 64 selectFolder_: function() { |
73 this.dispatch(bookmarks.actions.selectFolder(this.item_.id)); | 65 this.dispatch(bookmarks.actions.selectFolder(this.item_.id)); |
74 }, | 66 }, |
75 | 67 |
76 /** | 68 /** |
77 * Occurs when the drop down arrow is tapped. | 69 * Occurs when the drop down arrow is tapped. |
78 * @private | 70 * @private |
| 71 * @param {!Event} |
79 */ | 72 */ |
80 toggleFolder_: function() { | 73 toggleFolder_: function(e) { |
81 this.dispatch( | 74 this.dispatch( |
82 bookmarks.actions.changeFolderOpen(this.item_.id, this.isClosed_)); | 75 bookmarks.actions.changeFolderOpen(this.item_.id, this.isClosed_)); |
| 76 e.stopPropagation(); |
83 }, | 77 }, |
84 | 78 |
85 /** | 79 /** |
86 * @private | 80 * @private |
87 * @param {string} itemId | 81 * @param {string} itemId |
88 * @param {string} selectedFolder | 82 * @param {string} selectedFolder |
89 * @return {boolean} | 83 * @return {boolean} |
90 */ | 84 */ |
91 computeIsSelected_: function(itemId, selectedFolder) { | 85 computeIsSelected_: function(itemId, selectedFolder) { |
92 return itemId == selectedFolder; | 86 return itemId == selectedFolder; |
(...skipping 26 matching lines...) Expand all Loading... |
119 | 113 |
120 /** | 114 /** |
121 * @param {string} itemId | 115 * @param {string} itemId |
122 * @private | 116 * @private |
123 * @return {boolean} | 117 * @return {boolean} |
124 */ | 118 */ |
125 isFolder_: function(itemId) { | 119 isFolder_: function(itemId) { |
126 return !this.getState().nodes[itemId].url; | 120 return !this.getState().nodes[itemId].url; |
127 } | 121 } |
128 }); | 122 }); |
OLD | NEW |