OLD | NEW |
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 UI.CommandMenu = class { | 7 UI.CommandMenu = class { |
8 constructor() { | 8 constructor() { |
9 this._commands = []; | 9 this._commands = []; |
10 this._loadCommands(); | 10 this._loadCommands(); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 var index = String.hashCode(command.category()) % UI.CommandMenuDelegate.Mat
erialPaletteColors.length; | 218 var index = String.hashCode(command.category()) % UI.CommandMenuDelegate.Mat
erialPaletteColors.length; |
219 tagElement.style.backgroundColor = UI.CommandMenuDelegate.MaterialPaletteCol
ors[index]; | 219 tagElement.style.backgroundColor = UI.CommandMenuDelegate.MaterialPaletteCol
ors[index]; |
220 tagElement.textContent = command.category(); | 220 tagElement.textContent = command.category(); |
221 titleElement.createTextChild(command.title()); | 221 titleElement.createTextChild(command.title()); |
222 this.highlightRanges(titleElement, query); | 222 this.highlightRanges(titleElement, query); |
223 subtitleElement.textContent = command.shortcut(); | 223 subtitleElement.textContent = command.shortcut(); |
224 } | 224 } |
225 | 225 |
226 /** | 226 /** |
227 * @override | 227 * @override |
228 * @param {?number} itemIndex | 228 * @param {number} itemIndex |
229 * @param {string} promptValue | 229 * @param {string} promptValue |
230 */ | 230 */ |
231 selectItem(itemIndex, promptValue) { | 231 selectItem(itemIndex, promptValue) { |
232 this._commands[itemIndex].execute(); | 232 this._commands[itemIndex].execute(); |
233 } | 233 } |
234 | 234 |
235 /** | 235 /** |
236 * @override | 236 * @override |
237 * @return {boolean} | 237 * @return {boolean} |
238 */ | 238 */ |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 * @param {!UI.Context} context | 329 * @param {!UI.Context} context |
330 * @param {string} actionId | 330 * @param {string} actionId |
331 * @return {boolean} | 331 * @return {boolean} |
332 */ | 332 */ |
333 handleAction(context, actionId) { | 333 handleAction(context, actionId) { |
334 new UI.FilteredListWidget(new UI.CommandMenuDelegate()).showAsDialog(); | 334 new UI.FilteredListWidget(new UI.CommandMenuDelegate()).showAsDialog(); |
335 InspectorFrontendHost.bringToFront(); | 335 InspectorFrontendHost.bringToFront(); |
336 return true; | 336 return true; |
337 } | 337 } |
338 }; | 338 }; |
OLD | NEW |