| 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-list', | 6 is: 'bookmarks-list', |
| 7 | 7 |
| 8 behaviors: [ |
| 9 bookmarks.StoreClient, |
| 10 ], |
| 11 |
| 8 properties: { | 12 properties: { |
| 9 /** @type {BookmarkTreeNode} */ | 13 /** @type {BookmarkNode} */ |
| 10 menuItem_: Object, | 14 menuItem_: Object, |
| 11 | 15 |
| 12 /** @type {Array<BookmarkTreeNode>} */ | 16 /** @type {Array<string>} */ |
| 13 displayedList: Array, | 17 displayedList: { |
| 18 type: Array, |
| 19 value: function() { |
| 20 return []; |
| 21 }, |
| 22 }, |
| 14 | 23 |
| 15 searchTerm: String, | 24 searchTerm: String, |
| 16 }, | 25 }, |
| 17 | 26 |
| 18 listeners: { | 27 listeners: { |
| 19 'open-item-menu': 'onOpenItemMenu_', | 28 'open-item-menu': 'onOpenItemMenu_', |
| 20 }, | 29 }, |
| 21 | 30 |
| 31 attached: function() { |
| 32 this.observe('displayedList', function(state) { |
| 33 return bookmarks.util.getDisplayedList(state); |
| 34 }); |
| 35 this.observe('searchTerm', function(state) { |
| 36 return state.search.term; |
| 37 }); |
| 38 this.updateFromStore(); |
| 39 }, |
| 40 |
| 22 /** | 41 /** |
| 23 * @param {Event} e | 42 * @param {Event} e |
| 24 * @private | 43 * @private |
| 25 */ | 44 */ |
| 26 onOpenItemMenu_: function(e) { | 45 onOpenItemMenu_: function(e) { |
| 27 this.menuItem_ = e.detail.item; | 46 this.menuItem_ = e.detail.item; |
| 28 var menu = /** @type {!CrActionMenuElement} */ ( | 47 var menu = /** @type {!CrActionMenuElement} */ ( |
| 29 this.$.dropdown); | 48 this.$.dropdown); |
| 30 menu.showAt(/** @type {!Element} */ (e.detail.target)); | 49 menu.showAt(/** @type {!Element} */ (e.detail.target)); |
| 31 }, | 50 }, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 emptyListMessage_: function() { | 116 emptyListMessage_: function() { |
| 98 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; | 117 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; |
| 99 return loadTimeData.getString(emptyListMessage); | 118 return loadTimeData.getString(emptyListMessage); |
| 100 }, | 119 }, |
| 101 | 120 |
| 102 /** @private */ | 121 /** @private */ |
| 103 isEmptyList_: function() { | 122 isEmptyList_: function() { |
| 104 return this.displayedList.length == 0; | 123 return this.displayedList.length == 0; |
| 105 }, | 124 }, |
| 106 }); | 125 }); |
| OLD | NEW |