Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/quick_open/CommandMenu.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/quick_open/CommandMenu.js b/third_party/WebKit/Source/devtools/front_end/quick_open/CommandMenu.js |
| index 0ca09d36ba28d2e5971804e267708461ab3caed3..2c1bd92ad67867d9fed9e98f3a0815a98e31384b 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/quick_open/CommandMenu.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/quick_open/CommandMenu.js |
| @@ -71,23 +71,32 @@ QuickOpen.CommandMenu = class { |
| /** |
| * @param {!Runtime.Extension} extension |
| + * @param {string} category |
| * @return {!QuickOpen.CommandMenu.Command} |
| */ |
| - static createRevealDrawerCommand(extension) { |
| - var drawerId = extension.descriptor()['id']; |
| - var executeHandler = UI.viewManager.showView.bind(UI.viewManager, drawerId); |
| + static createRevealViewCommand(extension, category) { |
| + var viewId = extension.descriptor()['id']; |
| + var executeHandler = UI.viewManager.showView.bind(UI.viewManager, viewId); |
| var tags = extension.descriptor()['tags'] || ''; |
| return QuickOpen.CommandMenu.createCommand( |
| - Common.UIString('Drawer'), tags, Common.UIString('Show %s', extension.title()), '', executeHandler); |
| + category, tags, Common.UIString('Show %s', extension.title()), '', executeHandler); |
| } |
| _loadCommands() { |
| + var locations = new Map(); |
| + self.runtime.extensions(UI.ViewLocationResolver).forEach(extension => { |
| + var category = extension.descriptor()['category']; |
| + var name = extension.descriptor()['name']; |
| + if (category && name) |
| + locations.set(name, category); |
| + }); |
| var viewExtensions = self.runtime.extensions('view'); |
| for (var extension of viewExtensions) { |
| - if (extension.descriptor()['location'] === 'panel') |
| + var location = extension.descriptor()['location']; |
| + if (location === 'panel') |
|
pfeldman
2017/04/17 23:15:54
We are missing a resolver for the panels, you shou
einbinder
2017/04/17 23:52:06
Done.
|
| this._commands.push(QuickOpen.CommandMenu.createRevealPanelCommand(extension)); |
| - else if (extension.descriptor()['location'] === 'drawer-view') |
| - this._commands.push(QuickOpen.CommandMenu.createRevealDrawerCommand(extension)); |
| + else if (locations.has(location)) |
| + this._commands.push(QuickOpen.CommandMenu.createRevealViewCommand(extension, locations.get(location))); |
| } |
| // Populate whitelisted settings. |