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

Unified Diff: chrome/browser/resources/md_bookmarks/item.js

Issue 2872163002: MD Bookmarks: Add 'Open' command, to open in either the BMM or in new tabs (Closed)
Patch Set: Rebase Created 3 years, 7 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/item.js
diff --git a/chrome/browser/resources/md_bookmarks/item.js b/chrome/browser/resources/md_bookmarks/item.js
index dbfcb47b4f271e3ce402ed498d9ab7eb06374514..fdb20805c2999f683f39e46ec1b5db1ce413b88d 100644
--- a/chrome/browser/resources/md_bookmarks/item.js
+++ b/chrome/browser/resources/md_bookmarks/item.js
@@ -37,6 +37,9 @@ Polymer({
/** @private */
isFolder_: Boolean,
+
+ /** @private */
+ openItemUrl_: String,
},
observers: [
@@ -90,6 +93,7 @@ Polymer({
*/
onMenuButtonClick_: function(e) {
e.stopPropagation();
+ e.preventDefault();
this.dispatch(bookmarks.actions.selectItem(
this.itemId, false, false, this.getState()));
this.fire('open-item-menu', {
@@ -116,6 +120,10 @@ Polymer({
/** @private */
onItemChanged_: function() {
this.isFolder_ = !this.item_.url;
+ if (this.item_.url)
+ this.openItemUrl_ = this.item_.url;
+ else
+ this.openItemUrl_ = 'chrome://bookmarks/?id=' + this.itemId;
},
/**
@@ -133,26 +141,25 @@ Polymer({
},
/**
- * @param {Event} e
+ * @param {MouseEvent} e
* @private
*/
onClick_: function(e) {
this.dispatch(bookmarks.actions.selectItem(
this.itemId, e.ctrlKey, e.shiftKey, this.getState()));
e.stopPropagation();
+ e.preventDefault();
},
/**
- * @param {Event} e
+ * @param {MouseEvent} e
* @private
*/
onDblClick_: function(e) {
- if (!this.item_.url) {
- this.dispatch(
- bookmarks.actions.selectFolder(this.item_.id, this.getState().nodes));
- } else {
- chrome.tabs.create({url: this.item_.url});
- }
+ var commandManager = bookmarks.CommandManager.getInstance();
+ var itemSet = this.getState().selection.items;
+ if (commandManager.canExecute(Command.OPEN, itemSet))
+ commandManager.handle(Command.OPEN, itemSet);
},
/**
« no previous file with comments | « chrome/browser/resources/md_bookmarks/item.html ('k') | chrome/test/data/webui/md_bookmarks/actions_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698