Chromium Code Reviews| 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 properties: { | 8 properties: { |
| 9 /** @type {BookmarkTreeNode} */ | 9 /** @type {BookmarkTreeNode} */ |
| 10 item: Object, | 10 item: Object, |
| 11 | 11 |
| 12 isSelected: { | 12 isSelected: { |
| 13 type: Boolean, | 13 type: Boolean, |
| 14 value: false, | 14 value: false, |
| 15 reflectToAttribute: true, | 15 reflectToAttribute: true, |
| 16 }, | 16 }, |
| 17 | |
| 18 sidebarActive: { | |
|
tsergeant
2017/01/06 02:43:54
To avoid passing this all the way down the tree, i
angelayang
2017/01/12 05:04:32
Done.
| |
| 19 type: Boolean, | |
| 20 value: true, | |
| 21 reflectToAttribute: true, | |
| 22 }, | |
| 17 }, | 23 }, |
| 18 | 24 |
| 19 /** | 25 /** |
| 20 * @private | 26 * @private |
| 21 * @return {string} | 27 * @return {string} |
| 22 */ | 28 */ |
| 23 getFolderIcon_: function() { | 29 getFolderIcon_: function() { |
| 24 return this.isSelected ? 'bookmarks:folder-open' : 'bookmarks:folder'; | 30 return this.isSelected && this.sidebarActive ? 'bookmarks:folder-open' : |
| 31 'bookmarks:folder'; | |
| 25 }, | 32 }, |
| 26 | 33 |
| 27 /** | 34 /** |
| 28 * @private | 35 * @private |
| 29 * @return {string} | 36 * @return {string} |
| 30 */ | 37 */ |
| 31 getArrowIcon_: function() { | 38 getArrowIcon_: function() { |
| 32 return this.item.isOpen ? 'bookmarks:arrow-drop-up' : | 39 return this.item.isOpen ? 'bookmarks:arrow-drop-up' : |
| 33 'bookmarks:arrow-drop-down'; | 40 'bookmarks:arrow-drop-down'; |
| 34 }, | 41 }, |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 54 * @return {boolean} | 61 * @return {boolean} |
| 55 */ | 62 */ |
| 56 hasChildFolder_: function() { | 63 hasChildFolder_: function() { |
| 57 for (var i = 0; i < this.item.children.length; i++) { | 64 for (var i = 0; i < this.item.children.length; i++) { |
| 58 if (!this.item.children[i].url) | 65 if (!this.item.children[i].url) |
| 59 return true; | 66 return true; |
| 60 } | 67 } |
| 61 return false; | 68 return false; |
| 62 }, | 69 }, |
| 63 }); | 70 }); |
| OLD | NEW |