| 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, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 onCopyURLTap_: function() { | 42 onCopyURLTap_: function() { |
| 43 var idList = [this.menuItem_.id]; | 43 var idList = [this.menuItem_.id]; |
| 44 chrome.bookmarkManagerPrivate.copy(idList, function() { | 44 chrome.bookmarkManagerPrivate.copy(idList, function() { |
| 45 // TODO(jiaxi): Add toast later. | 45 // TODO(jiaxi): Add toast later. |
| 46 }); | 46 }); |
| 47 this.closeDropdownMenu_(); | 47 this.closeDropdownMenu_(); |
| 48 }, | 48 }, |
| 49 | 49 |
| 50 /** @private */ | 50 /** @private */ |
| 51 onDeleteTap_: function() { | 51 onDeleteTap_: function() { |
| 52 if (this.menuItem_.url) { | 52 this.fire('remove-item', this.menuItem_); |
| 53 chrome.bookmarks.remove(this.menuItem_.id, function() { | |
| 54 // TODO(jiaxi): Add toast later. | |
| 55 }.bind(this)); | |
| 56 } else { | |
| 57 chrome.bookmarks.removeTree(this.menuItem_.id, function() { | |
| 58 // TODO(jiaxi): Add toast later. | |
| 59 }.bind(this)); | |
| 60 } | |
| 61 this.closeDropdownMenu_(); | 53 this.closeDropdownMenu_(); |
| 62 }, | 54 }, |
| 63 | 55 |
| 64 /** @private */ | 56 /** @private */ |
| 65 onSaveEditTap_: function() { | 57 onSaveEditTap_: function() { |
| 66 chrome.bookmarks.update(this.menuItem_.id, { | 58 chrome.bookmarks.update(this.menuItem_.id, { |
| 67 'title': this.menuItem_.title, | 59 'title': this.menuItem_.title, |
| 68 'url': this.menuItem_.url, | 60 'url': this.menuItem_.url, |
| 69 }); | 61 }); |
| 70 this.$.editBookmark.close(); | 62 this.$.editBookmark.close(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 86 emptyListMessage_: function() { | 78 emptyListMessage_: function() { |
| 87 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; | 79 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; |
| 88 return loadTimeData.getString(emptyListMessage); | 80 return loadTimeData.getString(emptyListMessage); |
| 89 }, | 81 }, |
| 90 | 82 |
| 91 /** @private */ | 83 /** @private */ |
| 92 isEmptyList_: function() { | 84 isEmptyList_: function() { |
| 93 return this.displayedList.length == 0; | 85 return this.displayedList.length == 0; |
| 94 }, | 86 }, |
| 95 }); | 87 }); |
| OLD | NEW |