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

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

Issue 2721723002: DevTools: Restore show panel commands in CommandMenu (Closed)
Patch Set: Test Created 3 years, 9 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 | « third_party/WebKit/LayoutTests/inspector/quick-open/command-menu-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 QuickOpen.CommandMenu = class { 7 QuickOpen.CommandMenu = class {
8 constructor() { 8 constructor() {
9 this._commands = []; 9 this._commands = [];
10 this._loadCommands(); 10 this._loadCommands();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 var shortcut = UI.shortcutRegistry.shortcutTitleForAction(action.id()) || '' ; 55 var shortcut = UI.shortcutRegistry.shortcutTitleForAction(action.id()) || '' ;
56 return QuickOpen.CommandMenu.createCommand( 56 return QuickOpen.CommandMenu.createCommand(
57 action.category(), action.tags(), action.title(), shortcut, action.execu te.bind(action)); 57 action.category(), action.tags(), action.title(), shortcut, action.execu te.bind(action));
58 } 58 }
59 59
60 /** 60 /**
61 * @param {!Runtime.Extension} extension 61 * @param {!Runtime.Extension} extension
62 * @return {!QuickOpen.CommandMenu.Command} 62 * @return {!QuickOpen.CommandMenu.Command}
63 */ 63 */
64 static createRevealPanelCommand(extension) { 64 static createRevealPanelCommand(extension) {
65 var panelName = extension.descriptor()['name']; 65 var panelId = extension.descriptor()['id'];
66 var executeHandler = UI.viewManager.showView.bind(UI.viewManager, panelId);
66 var tags = extension.descriptor()['tags'] || ''; 67 var tags = extension.descriptor()['tags'] || '';
67 return QuickOpen.CommandMenu.createCommand( 68 return QuickOpen.CommandMenu.createCommand(
68 Common.UIString('Panel'), tags, Common.UIString('Show %s', extension.tit le()), '', executeHandler, 69 Common.UIString('Panel'), tags, Common.UIString('Show %s', extension.tit le()), '', executeHandler);
69 availableHandler);
70
71 /**
72 * @return {boolean}
73 */
74 function availableHandler() {
75 return true;
76 }
77
78 function executeHandler() {
79 UI.viewManager.showView(panelName);
80 }
81 } 70 }
82 71
83 /** 72 /**
84 * @param {!Runtime.Extension} extension 73 * @param {!Runtime.Extension} extension
85 * @return {!QuickOpen.CommandMenu.Command} 74 * @return {!QuickOpen.CommandMenu.Command}
86 */ 75 */
87 static createRevealDrawerCommand(extension) { 76 static createRevealDrawerCommand(extension) {
88 var drawerId = extension.descriptor()['id']; 77 var drawerId = extension.descriptor()['id'];
89 var executeHandler = UI.viewManager.showView.bind(UI.viewManager, drawerId); 78 var executeHandler = UI.viewManager.showView.bind(UI.viewManager, drawerId);
90 var tags = extension.descriptor()['tags'] || ''; 79 var tags = extension.descriptor()['tags'] || '';
91 return QuickOpen.CommandMenu.createCommand( 80 return QuickOpen.CommandMenu.createCommand(
92 Common.UIString('Drawer'), tags, Common.UIString('Show %s', extension.ti tle()), '', executeHandler); 81 Common.UIString('Drawer'), tags, Common.UIString('Show %s', extension.ti tle()), '', executeHandler);
93 } 82 }
94 83
95 _loadCommands() { 84 _loadCommands() {
96 // Populate panels. 85 var viewExtensions = self.runtime.extensions('view');
97 var panelExtensions = self.runtime.extensions(UI.Panel); 86 for (var extension of viewExtensions) {
98 for (var extension of panelExtensions) 87 if (extension.descriptor()['location'] === 'panel')
99 this._commands.push(QuickOpen.CommandMenu.createRevealPanelCommand(extensi on)); 88 this._commands.push(QuickOpen.CommandMenu.createRevealPanelCommand(exten sion));
100 89 else if (extension.descriptor()['location'] === 'drawer-view')
101 // Populate drawers. 90 this._commands.push(QuickOpen.CommandMenu.createRevealDrawerCommand(exte nsion));
102 var drawerExtensions = self.runtime.extensions('view');
103 for (var extension of drawerExtensions) {
104 if (extension.descriptor()['location'] !== 'drawer-view')
105 continue;
106 this._commands.push(QuickOpen.CommandMenu.createRevealDrawerCommand(extens ion));
107 } 91 }
108 92
109 // Populate whitelisted settings. 93 // Populate whitelisted settings.
110 var settingExtensions = self.runtime.extensions('setting'); 94 var settingExtensions = self.runtime.extensions('setting');
111 for (var extension of settingExtensions) { 95 for (var extension of settingExtensions) {
112 var options = extension.descriptor()['options']; 96 var options = extension.descriptor()['options'];
113 if (!options || !extension.descriptor()['category']) 97 if (!options || !extension.descriptor()['category'])
114 continue; 98 continue;
115 for (var pair of options) 99 for (var pair of options)
116 this._commands.push(QuickOpen.CommandMenu.createSettingCommand(extension , pair['title'], pair['value'])); 100 this._commands.push(QuickOpen.CommandMenu.createSettingCommand(extension , pair['title'], pair['value']));
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 * @param {!UI.Context} context 316 * @param {!UI.Context} context
333 * @param {string} actionId 317 * @param {string} actionId
334 * @return {boolean} 318 * @return {boolean}
335 */ 319 */
336 handleAction(context, actionId) { 320 handleAction(context, actionId) {
337 new QuickOpen.FilteredListWidget(new QuickOpen.CommandMenuDelegate()).showAs Dialog(); 321 new QuickOpen.FilteredListWidget(new QuickOpen.CommandMenuDelegate()).showAs Dialog();
338 InspectorFrontendHost.bringToFront(); 322 InspectorFrontendHost.bringToFront();
339 return true; 323 return true;
340 } 324 }
341 }; 325 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/quick-open/command-menu-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698