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

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

Issue 2617943002: [MD Bookmarks] Edit Bookmarks. (Closed)
Patch Set: style fix 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,
(...skipping 12 matching lines...) Expand all
23 */ 23 */
24 onOpenItemMenu_: function(e) { 24 onOpenItemMenu_: function(e) {
25 this.menuItem_ = e.detail.item; 25 this.menuItem_ = e.detail.item;
26 var menu = /** @type {!CrActionMenuElement} */ ( 26 var menu = /** @type {!CrActionMenuElement} */ (
27 this.$.dropdown); 27 this.$.dropdown);
28 menu.showAt(/** @type {!Element} */ (e.detail.target)); 28 menu.showAt(/** @type {!Element} */ (e.detail.target));
29 }, 29 },
30 30
31 // TODO(jiaxi): change these dummy click event handlers later. 31 // TODO(jiaxi): change these dummy click event handlers later.
32 /** @private */ 32 /** @private */
33 onEditTap_: function() { 33 onEditTap_: function() {
tsergeant 2017/01/09 00:21:04 I think you should probably assert or if-guard to
jiaxi 2017/01/09 02:17:46 Done.
34 this.closeDropdownMenu_(); 34 this.closeDropdownMenu_();
35 this.$.editBookmark.showModal();
35 }, 36 },
36 37
37 /** @private */ 38 /** @private */
38 onCopyURLTap_: function() { 39 onCopyURLTap_: function() {
39 var idList = [this.menuItem_.id]; 40 var idList = [this.menuItem_.id];
40 chrome.bookmarkManagerPrivate.copy(idList, function() { 41 chrome.bookmarkManagerPrivate.copy(idList, function() {
41 // TODO(jiaxi): Add toast later. 42 // TODO(jiaxi): Add toast later.
42 }); 43 });
43 this.closeDropdownMenu_(); 44 this.closeDropdownMenu_();
44 }, 45 },
45 46
46 /** @private */ 47 /** @private */
47 onDeleteTap_: function() { 48 onDeleteTap_: function() {
48 if (this.menuItem_.children) { 49 if (this.menuItem_.children) {
49 chrome.bookmarks.removeTree(this.menuItem_.id, function() { 50 chrome.bookmarks.removeTree(this.menuItem_.id, function() {
50 // TODO(jiaxi): Add toast later. 51 // TODO(jiaxi): Add toast later.
51 }.bind(this)); 52 }.bind(this));
52 } else { 53 } else {
53 chrome.bookmarks.remove(this.menuItem_.id, function() { 54 chrome.bookmarks.remove(this.menuItem_.id, function() {
54 // TODO(jiaxi): Add toast later. 55 // TODO(jiaxi): Add toast later.
55 }.bind(this)); 56 }.bind(this));
56 } 57 }
57 this.closeDropdownMenu_(); 58 this.closeDropdownMenu_();
58 }, 59 },
59 60
60 /** @private */ 61 /** @private */
62 onSaveEditTap_: function() {
63 chrome.bookmarks.update(this.menuItem_.id, {
64 'title': this.menuItem_.title,
65 'url': this.menuItem_.url,
66 });
67 this.$.editBookmark.close();
68 },
69
70 /** @private */
71 onCancelEditTap_: function() {
72 this.$.editBookmark.cancel();
73 },
74
75 /** @private */
61 closeDropdownMenu_: function() { 76 closeDropdownMenu_: function() {
62 var menu = /** @type {!CrActionMenuElement} */ ( 77 var menu = /** @type {!CrActionMenuElement} */ (
63 this.$.dropdown); 78 this.$.dropdown);
64 menu.close(); 79 menu.close();
65 } 80 }
66 }); 81 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698