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

Unified Diff: third_party/WebKit/Source/devtools/front_end/quick_open/CommandMenu.js

Issue 2815373003: DevTools: Add more views to command menu (Closed)
Patch Set: Add panel location Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
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..90b98ea8dd0b2eb236b54364aad6e62857f7d0ab 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
@@ -59,35 +59,30 @@ QuickOpen.CommandMenu = class {
/**
* @param {!Runtime.Extension} extension
+ * @param {string} category
* @return {!QuickOpen.CommandMenu.Command}
*/
- static createRevealPanelCommand(extension) {
- var panelId = extension.descriptor()['id'];
- var executeHandler = UI.viewManager.showView.bind(UI.viewManager, panelId);
- var tags = extension.descriptor()['tags'] || '';
- return QuickOpen.CommandMenu.createCommand(
- Common.UIString('Panel'), tags, Common.UIString('Show %s', extension.title()), '', executeHandler);
- }
-
- /**
- * @param {!Runtime.Extension} extension
- * @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')
- this._commands.push(QuickOpen.CommandMenu.createRevealPanelCommand(extension));
- else if (extension.descriptor()['location'] === 'drawer-view')
- this._commands.push(QuickOpen.CommandMenu.createRevealDrawerCommand(extension));
+ var category = locations.get(extension.descriptor()['location']);
+ if (category)
+ this._commands.push(QuickOpen.CommandMenu.createRevealViewCommand(extension, category));
}
// Populate whitelisted settings.

Powered by Google App Engine
This is Rietveld 408576698