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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_bookmarks/list.js
diff --git a/chrome/browser/resources/md_bookmarks/list.js b/chrome/browser/resources/md_bookmarks/list.js
index 426cbb33be433e5dafe803e9ac440ab97314edc7..3752d15b7f4ac9787fa19b50f161a992a85b46f1 100644
--- a/chrome/browser/resources/md_bookmarks/list.js
+++ b/chrome/browser/resources/md_bookmarks/list.js
@@ -8,17 +8,21 @@ Polymer({
properties: {
/** @type {BookmarkTreeNode} */
selectedNode: Object,
+
+ /** @type {BookmarkTreeNode} */
+ menuItem_: Object,
},
listeners: {
- 'toggle-menu': 'onToggleMenu_'
+ 'open-item-menu': 'onOpenItemMenu_',
},
/**
* @param {Event} e
* @private
*/
- onToggleMenu_: function(e) {
+ onOpenItemMenu_: function(e) {
+ this.menuItem_ = e.detail.item;
var menu = /** @type {!CrActionMenuElement} */ (
this.$.dropdown);
menu.showAt(/** @type {!Element} */ (e.detail.target));
@@ -26,18 +30,29 @@ Polymer({
// TODO(jiaxi): change these dummy click event handlers later.
/** @private */
- onEditTap_: function() {
- this.closeDropdownMenu_();
- },
+ onEditTap_: function() { this.closeDropdownMenu_(); },
/** @private */
onCopyURLTap_: function() {
+ var idList = [this.menuItem_.id];
+ chrome.bookmarkManagerPrivate.copy(idList, function() {
+ // TODO(jiaxi): Add toast later.
+ });
this.closeDropdownMenu_();
},
/** @private */
onDeleteTap_: function() {
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.
+ if (this.menuItem_.children) {
+ chrome.bookmarks.removeTree(this.menuItem_.id, function() {
+ // TODO(jiaxi): Add toast later.
+ }.bind(this));
+ } else {
+ chrome.bookmarks.remove(this.menuItem_.id, function() {
+ // TODO(jiaxi): Add toast later.
+ }.bind(this));
+ }
},
/** @private */

Powered by Google App Engine
This is Rietveld 408576698