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

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: fix a merge problem 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() {
30 this.closeDropdownMenu_(); 34 this.closeDropdownMenu_();
31 }, 35 },
32 36
33 /** @private */ 37 /** @private */
34 onCopyURLTap_: function() { 38 onCopyURLTap_: function() {
39 var idList = [this.menuItem_.id];
40 chrome.bookmarkManagerPrivate.copy(idList, function() {
41 // TODO(jiaxi): Add toast later.
42 });
35 this.closeDropdownMenu_(); 43 this.closeDropdownMenu_();
36 }, 44 },
37 45
38 /** @private */ 46 /** @private */
39 onDeleteTap_: function() { 47 onDeleteTap_: function() {
48 if (this.menuItem_.children) {
49 chrome.bookmarks.removeTree(this.menuItem_.id, function() {
50 // TODO(jiaxi): Add toast later.
51 }.bind(this));
52 } else {
53 chrome.bookmarks.remove(this.menuItem_.id, function() {
54 // TODO(jiaxi): Add toast later.
55 }.bind(this));
56 }
40 this.closeDropdownMenu_(); 57 this.closeDropdownMenu_();
41 }, 58 },
42 59
43 /** @private */ 60 /** @private */
44 closeDropdownMenu_: function() { 61 closeDropdownMenu_: function() {
45 var menu = /** @type {!CrActionMenuElement} */ ( 62 var menu = /** @type {!CrActionMenuElement} */ (
46 this.$.dropdown); 63 this.$.dropdown);
47 menu.close(); 64 menu.close();
48 } 65 }
49 }); 66 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/item.js ('k') | chrome/browser/resources/md_bookmarks/store.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698