Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: chrome/browser/resources/md_bookmarks/list.js

Issue 2613683002: [MD Bookmarks] Add Delete and Copy URL for Material Bookmarks. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 selectedNode: Object, 10 selectedNode: Object,
11
12 /** @type {BookmarkTreeNode} */
13 menuItem_: Object,
11 }, 14 },
12 15
13 listeners: { 16 listeners: {
14 'toggle-menu': 'onToggleMenu_' 17 'open-item-menu': 'onOpenItemMenu_',
15 }, 18 },
16 19
17 /** 20 /**
18 * @param {Event} e 21 * @param {Event} e
19 * @private 22 * @private
20 */ 23 */
21 onToggleMenu_: function(e) { 24 onOpenItemMenu_: function(e) {
25 this.menuItem_ = e.detail.item;
22 var menu = /** @type {!CrActionMenuElement} */ ( 26 var menu = /** @type {!CrActionMenuElement} */ (
23 this.$.dropdown); 27 this.$.dropdown);
24 menu.showAt(/** @type {!Element} */ (e.detail.target)); 28 menu.showAt(/** @type {!Element} */ (e.detail.target));
25 }, 29 },
26 30
27 // TODO(jiaxi): change these dummy click event handlers later. 31 // TODO(jiaxi): change these dummy click event handlers later.
28 /** @private */ 32 /** @private */
29 onEditTap_: function() { 33 onEditTap_: function() { this.closeDropdownMenu_(); },
30 this.closeDropdownMenu_();
31 },
32 34
33 /** @private */ 35 /** @private */
34 onCopyURLTap_: function() { 36 onCopyURLTap_: function() {
37 var idList = [this.menuItem_.id];
38 chrome.bookmarkManagerPrivate.copy(idList, function() {
39 // TODO(jiaxi): Add toast later.
40 });
35 this.closeDropdownMenu_(); 41 this.closeDropdownMenu_();
36 }, 42 },
37 43
38 /** @private */ 44 /** @private */
39 onDeleteTap_: function() { 45 onDeleteTap_: function() {
40 this.closeDropdownMenu_(); 46 this.closeDropdownMenu_();
calamity 2017/01/04 06:57:44 For consistency, move this to the end of the metho
jiaxi 2017/01/04 22:44:00 Done.
47 if (this.menuItem_.children) {
48 chrome.bookmarks.removeTree(this.menuItem_.id, function() {
49 // TODO(jiaxi): Add toast later.
50 }.bind(this));
51 } else {
52 chrome.bookmarks.remove(this.menuItem_.id, function() {
53 // TODO(jiaxi): Add toast later.
54 }.bind(this));
55 }
41 }, 56 },
42 57
43 /** @private */ 58 /** @private */
44 closeDropdownMenu_: function() { 59 closeDropdownMenu_: function() {
45 var menu = /** @type {!CrActionMenuElement} */ ( 60 var menu = /** @type {!CrActionMenuElement} */ (
46 this.$.dropdown); 61 this.$.dropdown);
47 menu.close(); 62 menu.close();
48 } 63 }
49 }); 64 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698