Chromium Code Reviews| Index: chrome/browser/resources/md_bookmarks/folder_node.js |
| diff --git a/chrome/browser/resources/md_bookmarks/folder_node.js b/chrome/browser/resources/md_bookmarks/folder_node.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..04249f9f986e6d04c53c0ec76ef597ef5a60d28b |
| --- /dev/null |
| +++ b/chrome/browser/resources/md_bookmarks/folder_node.js |
| @@ -0,0 +1,65 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +Polymer({ |
| + is: 'bookmarks-folder-node', |
| + |
| + properties: { |
| + /** @type {BookmarkTreeNode} */ |
| + item: Object, |
| + |
| + isSelected: { |
| + type: Boolean, |
| + value: false, |
| + reflectToAttribute: true, |
| + }, |
| + }, |
| + |
| + /** |
| + * @private |
| + * @return {string} |
| + */ |
| + getFolderIcon_: function() { |
| + //TODO(jiaxi): Move these icons to shared file. |
| + return this.isSelected ? 'bookmarks:folder-open' : 'bookmarks:folder'; |
| + }, |
| + |
| + /** |
| + * @private |
| + * @return {string} |
| + */ |
| + getArrowIcon_: function() { |
| + //TODO(jiaxi): Move these icons to shared file. |
|
calamity
2017/01/04 04:33:07
// TODO
But also, these TODOs should really be i
jiaxi
2017/01/04 04:41:31
Done.
|
| + return this.item.isOpen ? 'bookmarks:arrow-drop-up' : |
| + 'bookmarks:arrow-drop-down'; |
| + }, |
| + |
| + /** @private */ |
| + selectFolder_: function() { |
| + this.fire('selected-folder-changed', this.item.id); |
| + }, |
| + |
| + /** |
| + * Occurs when the drop down arrow is tapped. |
| + * @private |
| + */ |
| + toggleFolder_: function() { |
| + this.fire('folder-open-changed', { |
| + id: this.item.id, |
| + open: !this.item.isOpen, |
| + }); |
| + }, |
| + |
| + /** |
| + * @private |
| + * @return {boolean} |
| + */ |
| + hasChildFolder_: function() { |
| + for (var i = 0; i < this.item.children.length; i++) { |
| + if (!this.item.children[i].url) |
| + return true; |
| + } |
| + return false; |
| + }, |
| +}); |