Chromium Code Reviews| 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); |
| }, |
| /** |