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

Side by Side Diff: chrome/browser/resources/md_bookmarks/command_manager.js

Issue 2926233002: MD Bookmarks: Add right-click context menu to sidebar folders (Closed)
Patch Set: Don't reselect folder Created 3 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/folder_node.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/md_bookmarks/folder_node.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698