| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 /** | 5 /** |
| 6 * @fileoverview Element which shows context menus and handles keyboard | 6 * @fileoverview Element which shows context menus and handles keyboard |
| 7 * shortcuts. | 7 * shortcuts. |
| 8 */ | 8 */ |
| 9 cr.define('bookmarks', function() { | 9 cr.define('bookmarks', function() { |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 detached: function() { | 80 detached: function() { |
| 81 CommandManager.instance_ = null; | 81 CommandManager.instance_ = null; |
| 82 document.removeEventListener('open-item-menu', this.boundOnOpenItemMenu_); | 82 document.removeEventListener('open-item-menu', this.boundOnOpenItemMenu_); |
| 83 document.removeEventListener('command-undo', this.boundOnCommandUndo_); | 83 document.removeEventListener('command-undo', this.boundOnCommandUndo_); |
| 84 document.removeEventListener('keydown', this.boundOnKeydown_); | 84 document.removeEventListener('keydown', this.boundOnKeydown_); |
| 85 }, | 85 }, |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * Display the command context menu at (|x|, |y|) in window co-ordinates. | 88 * Display the command context menu at (|x|, |y|) in window co-ordinates. |
| 89 * Commands will execute on the currently selected items. | 89 * Commands will execute on |items| if given, or on the currently selected |
| 90 * items. |
| 90 * @param {number} x | 91 * @param {number} x |
| 91 * @param {number} y | 92 * @param {number} y |
| 93 * @param {Set<string>=} items |
| 92 */ | 94 */ |
| 93 openCommandMenuAtPosition: function(x, y) { | 95 openCommandMenuAtPosition: function(x, y, items) { |
| 94 this.menuIds_ = this.getState().selection.items; | 96 this.menuIds_ = items || this.getState().selection.items; |
| 95 /** @type {!CrActionMenuElement} */ (this.$.dropdown) | 97 /** @type {!CrActionMenuElement} */ (this.$.dropdown) |
| 96 .showAtPosition({top: y, left: x}); | 98 .showAtPosition({top: y, left: x}); |
| 97 }, | 99 }, |
| 98 | 100 |
| 99 /** | 101 /** |
| 100 * Display the command context menu positioned to cover the |target| | 102 * Display the command context menu positioned to cover the |target| |
| 101 * element. Commands will execute on the currently selected items. | 103 * element. Commands will execute on the currently selected items. |
| 102 * @param {!Element} target | 104 * @param {!Element} target |
| 103 */ | 105 */ |
| 104 openCommandMenuAtElement: function(target) { | 106 openCommandMenuAtElement: function(target) { |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 484 |
| 483 /** @return {!bookmarks.CommandManager} */ | 485 /** @return {!bookmarks.CommandManager} */ |
| 484 CommandManager.getInstance = function() { | 486 CommandManager.getInstance = function() { |
| 485 return assert(CommandManager.instance_); | 487 return assert(CommandManager.instance_); |
| 486 }; | 488 }; |
| 487 | 489 |
| 488 return { | 490 return { |
| 489 CommandManager: CommandManager, | 491 CommandManager: CommandManager, |
| 490 }; | 492 }; |
| 491 }); | 493 }); |
| OLD | NEW |