| 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 // Use an empty list during initialization so that the databinding to |
| 21 // hide #bookmarksCard takes effect. |
| 22 return []; |
| 23 }, |
| 24 }, |
| 14 | 25 |
| 15 searchTerm: String, | 26 searchTerm: String, |
| 16 }, | 27 }, |
| 17 | 28 |
| 18 listeners: { | 29 listeners: { |
| 19 'open-item-menu': 'onOpenItemMenu_', | 30 'open-item-menu': 'onOpenItemMenu_', |
| 20 }, | 31 }, |
| 21 | 32 |
| 33 attached: function() { |
| 34 this.watch('displayedList', function(state) { |
| 35 return bookmarks.util.getDisplayedList(state); |
| 36 }); |
| 37 this.updateFromStore(); |
| 38 }, |
| 39 |
| 22 /** | 40 /** |
| 23 * @param {Event} e | 41 * @param {Event} e |
| 24 * @private | 42 * @private |
| 25 */ | 43 */ |
| 26 onOpenItemMenu_: function(e) { | 44 onOpenItemMenu_: function(e) { |
| 27 this.menuItem_ = e.detail.item; | 45 this.menuItem_ = e.detail.item; |
| 28 var menu = /** @type {!CrActionMenuElement} */ ( | 46 var menu = /** @type {!CrActionMenuElement} */ ( |
| 29 this.$.dropdown); | 47 this.$.dropdown); |
| 30 menu.showAt(/** @type {!Element} */ (e.detail.target)); | 48 menu.showAt(/** @type {!Element} */ (e.detail.target)); |
| 31 }, | 49 }, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 emptyListMessage_: function() { | 115 emptyListMessage_: function() { |
| 98 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; | 116 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; |
| 99 return loadTimeData.getString(emptyListMessage); | 117 return loadTimeData.getString(emptyListMessage); |
| 100 }, | 118 }, |
| 101 | 119 |
| 102 /** @private */ | 120 /** @private */ |
| 103 isEmptyList_: function() { | 121 isEmptyList_: function() { |
| 104 return this.displayedList.length == 0; | 122 return this.displayedList.length == 0; |
| 105 }, | 123 }, |
| 106 }); | 124 }); |
| OLD | NEW |