OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 Polymer({ |
| 6 is: 'bookmarks-folder-node', |
| 7 |
| 8 properties: { |
| 9 /** @type {BookmarkTreeNode} */ |
| 10 item: Object, |
| 11 |
| 12 isSelected: { |
| 13 type: Boolean, |
| 14 value: false, |
| 15 reflectToAttribute: true, |
| 16 }, |
| 17 }, |
| 18 |
| 19 /** |
| 20 * @private |
| 21 * @return {string} |
| 22 */ |
| 23 getFolderIcon_: function() { |
| 24 //TODO(jiaxi): Move these icons to shared file. |
| 25 return this.isSelected ? 'bookmarks:folder-open' : 'bookmarks:folder'; |
| 26 }, |
| 27 |
| 28 /** |
| 29 * @private |
| 30 * @return {string} |
| 31 */ |
| 32 getArrowIcon_: function() { |
| 33 //TODO(jiaxi): Move these icons to shared file. |
| 34 return this.item.isOpen ? 'bookmarks:arrow-drop-up' : |
| 35 'bookmarks:arrow-drop-down'; |
| 36 }, |
| 37 |
| 38 /** @private */ |
| 39 selectFolder_: function() { |
| 40 this.fire('selected-folder-changed', this.item.id); |
| 41 }, |
| 42 |
| 43 /** |
| 44 * Occurs when the drop down arrow is tapped. |
| 45 * @private |
| 46 */ |
| 47 toggleFolder_: function() { |
| 48 this.fire('folder-open-changed', { |
| 49 id: this.item.id, |
| 50 open: !this.item.isOpen, |
| 51 }); |
| 52 }, |
| 53 |
| 54 /** |
| 55 * @private |
| 56 * @return {boolean} |
| 57 */ |
| 58 hasChildFolder_: function() { |
| 59 for (var i = 0; i < this.item.children.length; i++) { |
| 60 if (!this.item.children[i].url) |
| 61 return true; |
| 62 } |
| 63 return false; |
| 64 }, |
| 65 }); |
OLD | NEW |