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

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 c0be4847f2849e7449f9dea0103cdba3555ad008..7cebcd36f6aafad2321332f71f1d181417e8b461 100644
--- a/chrome/browser/resources/md_bookmarks/item.js
+++ b/chrome/browser/resources/md_bookmarks/item.js
@@ -29,6 +29,9 @@ Polymer({
/** @private */
isFolder_: Boolean,
+
+ /** @private */
+ openItemUrl_: String,
},
observers: [
@@ -106,29 +109,34 @@ 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;
},
/**
- * @param {Event} e
+ * @param {MouseEvent} e
* @private
*/
onClick_: function(e) {
- this.dispatch(bookmarks.actions.selectItem(
- this.itemId, e.ctrlKey, e.shiftKey, this.getState()));
+ if (e.detail == 1) {
calamity 2017/05/17 05:09:23 Comment explaining what this is for. (What _is_ th
tsergeant 2017/05/17 07:04:38 When you double click, the browser fires two click
calamity 2017/05/19 03:47:58 Acknowledged.
+ 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);
},
/**

Powered by Google App Engine
This is Rietveld 408576698