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-list', | 6 is: 'bookmarks-list', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 /** @type {BookmarkTreeNode} */ | 9 /** @type {BookmarkTreeNode} */ |
| 10 menuItem_: Object, | 10 menuItem_: Object, |
| 11 | 11 |
| 12 /** @type {Array<BookmarkTreeNode>} */ | 12 /** @type {Array<BookmarkTreeNode>} */ |
| 13 displayedList: Array, | 13 displayedList: Array, |
| 14 | 14 |
| 15 searchTerm: String, | 15 searchTerm: String, |
| 16 | |
| 17 hideUrlInput_: Boolean, | |
| 16 }, | 18 }, |
| 17 | 19 |
| 18 listeners: { | 20 listeners: { |
| 19 'open-item-menu': 'onOpenItemMenu_', | 21 'open-item-menu': 'onOpenItemMenu_', |
| 20 }, | 22 }, |
| 21 | 23 |
| 22 /** | 24 /** |
| 23 * @param {Event} e | 25 * @param {Event} e |
| 24 * @private | 26 * @private |
| 25 */ | 27 */ |
| 26 onOpenItemMenu_: function(e) { | 28 onOpenItemMenu_: function(e) { |
| 27 this.menuItem_ = e.detail.item; | 29 this.menuItem_ = e.detail.item; |
| 28 var menu = /** @type {!CrActionMenuElement} */ ( | 30 var menu = /** @type {!CrActionMenuElement} */ ( |
| 29 this.$.dropdown); | 31 this.$.dropdown); |
| 30 menu.showAt(/** @type {!Element} */ (e.detail.target)); | 32 menu.showAt(/** @type {!Element} */ (e.detail.target)); |
| 31 }, | 33 }, |
| 32 | 34 |
| 33 // TODO(jiaxi): change these dummy click event handlers later. | 35 // TODO(jiaxi): change these dummy click event handlers later. |
| 34 /** @private */ | 36 /** @private */ |
| 35 onEditTap_: function() { | 37 onEditTap_: function() { |
| 36 this.closeDropdownMenu_(); | 38 this.closeDropdownMenu_(); |
| 37 if (this.menuItem_.url) | 39 this.hideUrlInput_ = !this.menuItem_.url; |
| 38 this.$.editBookmark.showModal(); | 40 this.$.editBookmark.showModal(); |
| 39 }, | 41 }, |
| 40 | 42 |
| 41 /** @private */ | 43 /** @private */ |
| 42 onCopyURLTap_: function() { | 44 onCopyURLTap_: function() { |
| 43 var idList = [this.menuItem_.id]; | 45 var idList = [this.menuItem_.id]; |
| 44 chrome.bookmarkManagerPrivate.copy(idList, function() { | 46 chrome.bookmarkManagerPrivate.copy(idList, function() { |
| 45 // TODO(jiaxi): Add toast later. | 47 // TODO(jiaxi): Add toast later. |
| 46 }); | 48 }); |
| 47 this.closeDropdownMenu_(); | 49 this.closeDropdownMenu_(); |
| 48 }, | 50 }, |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 76 }, | 78 }, |
| 77 | 79 |
| 78 /** @private */ | 80 /** @private */ |
| 79 closeDropdownMenu_: function() { | 81 closeDropdownMenu_: function() { |
| 80 var menu = /** @type {!CrActionMenuElement} */ ( | 82 var menu = /** @type {!CrActionMenuElement} */ ( |
| 81 this.$.dropdown); | 83 this.$.dropdown); |
| 82 menu.close(); | 84 menu.close(); |
| 83 }, | 85 }, |
| 84 | 86 |
| 85 /** @private */ | 87 /** @private */ |
| 88 getEditorTitle_: function() { | |
| 89 var title = this.menuItem_.url ? 'editBookmarkTitle' : 'editFolderTitle'; | |
| 90 return this.loadTimeData.getString(title); | |
| 91 }, | |
|
jiaxi
2017/02/01 00:31:23
Hmm... I'm a bit confused here. Where is this func
angelayang
2017/02/01 02:47:34
Oops yes sorry i forgot to commit where i did use
| |
| 92 | |
| 93 /** @private */ | |
| 86 emptyListMessage_: function() { | 94 emptyListMessage_: function() { |
| 87 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; | 95 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; |
| 88 return loadTimeData.getString(emptyListMessage); | 96 return loadTimeData.getString(emptyListMessage); |
| 89 }, | 97 }, |
| 90 | 98 |
| 91 /** @private */ | 99 /** @private */ |
| 92 isEmptyList_: function() { | 100 isEmptyList_: function() { |
| 93 return this.displayedList.length == 0; | 101 return this.displayedList.length == 0; |
| 94 }, | 102 }, |
| 95 }); | 103 }); |
| OLD | NEW |