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 the currently selected items. |
calamity
2017/06/13 05:54:25
Update comment.
tsergeant
2017/06/13 07:01:54
Done.
| |
90 * @param {number} x | 90 * @param {number} x |
91 * @param {number} y | 91 * @param {number} y |
92 * @param {Set<string>=} items | |
92 */ | 93 */ |
93 openCommandMenuAtPosition: function(x, y) { | 94 openCommandMenuAtPosition: function(x, y, items) { |
94 this.menuIds_ = this.getState().selection.items; | 95 this.menuIds_ = items || this.getState().selection.items; |
95 /** @type {!CrActionMenuElement} */ (this.$.dropdown) | 96 /** @type {!CrActionMenuElement} */ (this.$.dropdown) |
96 .showAtPosition({top: y, left: x}); | 97 .showAtPosition({top: y, left: x}); |
97 }, | 98 }, |
98 | 99 |
99 /** | 100 /** |
100 * Display the command context menu positioned to cover the |target| | 101 * Display the command context menu positioned to cover the |target| |
101 * element. Commands will execute on the currently selected items. | 102 * element. Commands will execute on the currently selected items. |
102 * @param {!Element} target | 103 * @param {!Element} target |
103 */ | 104 */ |
104 openCommandMenuAtElement: function(target) { | 105 openCommandMenuAtElement: function(target) { |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 | 483 |
483 /** @return {!bookmarks.CommandManager} */ | 484 /** @return {!bookmarks.CommandManager} */ |
484 CommandManager.getInstance = function() { | 485 CommandManager.getInstance = function() { |
485 return assert(CommandManager.instance_); | 486 return assert(CommandManager.instance_); |
486 }; | 487 }; |
487 | 488 |
488 return { | 489 return { |
489 CommandManager: CommandManager, | 490 CommandManager: CommandManager, |
490 }; | 491 }; |
491 }); | 492 }); |
OLD | NEW |