| 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 */ | 7 */ |
| 8 WebInspector.CommandMenu = function() | 8 WebInspector.CommandMenu = function() |
| 9 { | 9 { |
| 10 this._commands = []; | 10 this._commands = []; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 300 } |
| 301 | 301 |
| 302 /** | 302 /** |
| 303 * @param {!Runtime.Extension} extension | 303 * @param {!Runtime.Extension} extension |
| 304 * @return {!WebInspector.CommandMenu.Command} | 304 * @return {!WebInspector.CommandMenu.Command} |
| 305 */ | 305 */ |
| 306 WebInspector.CommandMenu.createRevealPanelCommand = function(extension) | 306 WebInspector.CommandMenu.createRevealPanelCommand = function(extension) |
| 307 { | 307 { |
| 308 var panelName = extension.descriptor()["name"]; | 308 var panelName = extension.descriptor()["name"]; |
| 309 var tags = extension.descriptor()["tags"] || ""; | 309 var tags = extension.descriptor()["tags"] || ""; |
| 310 return WebInspector.CommandMenu.createCommand(WebInspector.UIString("Panel")
, tags, WebInspector.UIString("Show %s", extension.title(WebInspector.platform()
)), "", executeHandler, availableHandler); | 310 return WebInspector.CommandMenu.createCommand(WebInspector.UIString("Panel")
, tags, WebInspector.UIString("Show %s", extension.title()), "", executeHandler,
availableHandler); |
| 311 | 311 |
| 312 /** | 312 /** |
| 313 * @return {boolean} | 313 * @return {boolean} |
| 314 */ | 314 */ |
| 315 function availableHandler() | 315 function availableHandler() |
| 316 { | 316 { |
| 317 return WebInspector.inspectorView.currentPanel().name !== panelName; | 317 return WebInspector.inspectorView.currentPanel().name !== panelName; |
| 318 } | 318 } |
| 319 | 319 |
| 320 function executeHandler() | 320 function executeHandler() |
| 321 { | 321 { |
| 322 WebInspector.inspectorView.panel(panelName).then(WebInspector.inspectorV
iew.setCurrentPanel.bind(WebInspector.inspectorView)); | 322 WebInspector.inspectorView.panel(panelName).then(WebInspector.inspectorV
iew.setCurrentPanel.bind(WebInspector.inspectorView)); |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 | 325 |
| 326 /** | 326 /** |
| 327 * @param {!Runtime.Extension} extension | 327 * @param {!Runtime.Extension} extension |
| 328 * @return {!WebInspector.CommandMenu.Command} | 328 * @return {!WebInspector.CommandMenu.Command} |
| 329 */ | 329 */ |
| 330 WebInspector.CommandMenu.createRevealDrawerCommand = function(extension) | 330 WebInspector.CommandMenu.createRevealDrawerCommand = function(extension) |
| 331 { | 331 { |
| 332 var drawerId = extension.descriptor()["name"]; | 332 var drawerId = extension.descriptor()["name"]; |
| 333 var executeHandler = WebInspector.inspectorView.showViewInDrawer.bind(WebIns
pector.inspectorView, drawerId); | 333 var executeHandler = WebInspector.inspectorView.showViewInDrawer.bind(WebIns
pector.inspectorView, drawerId); |
| 334 var tags = extension.descriptor()["tags"] || ""; | 334 var tags = extension.descriptor()["tags"] || ""; |
| 335 return WebInspector.CommandMenu.createCommand(WebInspector.UIString("Drawer"
), tags, WebInspector.UIString("Show %s", extension.title(WebInspector.platform(
))), "", executeHandler); | 335 return WebInspector.CommandMenu.createCommand(WebInspector.UIString("Drawer"
), tags, WebInspector.UIString("Show %s", extension.title()), "", executeHandler
); |
| 336 } | 336 } |
| 337 | 337 |
| 338 /** @type {!WebInspector.CommandMenu} */ | 338 /** @type {!WebInspector.CommandMenu} */ |
| 339 WebInspector.commandMenu = new WebInspector.CommandMenu(); | 339 WebInspector.commandMenu = new WebInspector.CommandMenu(); |
| 340 | 340 |
| 341 /** | 341 /** |
| 342 * @constructor | 342 * @constructor |
| 343 * @implements {WebInspector.ActionDelegate} | 343 * @implements {WebInspector.ActionDelegate} |
| 344 */ | 344 */ |
| 345 WebInspector.CommandMenu.ShowActionDelegate = function() | 345 WebInspector.CommandMenu.ShowActionDelegate = function() |
| 346 { | 346 { |
| 347 } | 347 } |
| 348 | 348 |
| 349 WebInspector.CommandMenu.ShowActionDelegate.prototype = { | 349 WebInspector.CommandMenu.ShowActionDelegate.prototype = { |
| 350 /** | 350 /** |
| 351 * @override | 351 * @override |
| 352 * @param {!WebInspector.Context} context | 352 * @param {!WebInspector.Context} context |
| 353 * @param {string} actionId | 353 * @param {string} actionId |
| 354 * @return {boolean} | 354 * @return {boolean} |
| 355 */ | 355 */ |
| 356 handleAction: function(context, actionId) | 356 handleAction: function(context, actionId) |
| 357 { | 357 { |
| 358 new WebInspector.FilteredListWidget(new WebInspector.CommandMenuDelegate
()).showAsDialog(); | 358 new WebInspector.FilteredListWidget(new WebInspector.CommandMenuDelegate
()).showAsDialog(); |
| 359 InspectorFrontendHost.bringToFront(); | 359 InspectorFrontendHost.bringToFront(); |
| 360 return true; | 360 return true; |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| OLD | NEW |