Commit c72e9717 authored by apavlov@chromium.org's avatar apavlov@chromium.org

DevTools: Implement debugger pause-resume through an action

R=loislo, vsevik

Review URL: https://codereview.chromium.org/311193002

git-svn-id: svn://svn.chromium.org/blink/trunk@175786 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 77c8625d
......@@ -21,11 +21,9 @@ WebInspector.ForwardedInputEventHandler.prototype = {
if (type !== "keydown")
return;
// FIXME: Wire this to the shortcut/action subsystem.
if (keyIdentifier === "F8" && !modifiers)
/** @type {!WebInspector.SourcesPanel} */ (WebInspector.inspectorView.showPanel("sources")).togglePause();
WebInspector.context.setFlavor(WebInspector.ShortcutRegistry.ForwardedShortcut, WebInspector.ShortcutRegistry.ForwardedShortcut.instance)
WebInspector.shortcutRegistry.handleKey(WebInspector.KeyboardShortcut.makeKey(keyCode, modifiers), keyIdentifier);
WebInspector.context.setFlavor(WebInspector.ShortcutRegistry.ForwardedShortcut, null);
}
}
......
......@@ -198,6 +198,7 @@ WebInspector.SourcesPanel.prototype = {
wasShown: function()
{
WebInspector.context.setFlavor(WebInspector.SourcesPanel, this);
if (WebInspector.experimentsSettings.editorInDrawer.isEnabled()) {
this._drawerEditor()._panelWasShown();
this._sourcesView.show(this.editorView.mainElement());
......@@ -212,6 +213,7 @@ WebInspector.SourcesPanel.prototype = {
this._drawerEditor()._panelWillHide();
this._sourcesView.show(this._drawerEditorView.element);
}
WebInspector.context.setFlavor(WebInspector.SourcesPanel, null);
},
/**
......@@ -671,8 +673,8 @@ WebInspector.SourcesPanel.prototype = {
this._runSnippetButton.element.classList.add("hidden");
// Continue.
handler = this.togglePause.bind(this);
this._pauseButton = this._createButtonAndRegisterShortcuts("scripts-pause", "", handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.PauseContinue);
handler = function() { return WebInspector.actionRegistry.execute("debugger.toggle-pause"); };
this._pauseButton = this._createButtonAndRegisterShortcuts("scripts-pause", "", handler, []);
debugToolbar.appendChild(this._pauseButton.element);
// Long resume.
......@@ -1395,3 +1397,22 @@ WebInspector.SourcesPanel.DisableJavaScriptSettingDelegate.prototype = {
__proto__: WebInspector.UISettingDelegate.prototype
}
/**
* @constructor
* @implements {WebInspector.ActionDelegate}
*/
WebInspector.SourcesPanel.TogglePauseActionDelegate = function()
{
}
WebInspector.SourcesPanel.TogglePauseActionDelegate.prototype = {
/**
* @return {boolean}
*/
handleAction: function()
{
/** @type {!WebInspector.SourcesPanel} */ (WebInspector.inspectorView.showPanel("sources")).togglePause();
return true;
}
}
......@@ -12,6 +12,22 @@
"contextTypes": ["WebInspector.UISourceCode", "WebInspector.RemoteObject"],
"className": "WebInspector.SourcesPanel.ContextMenuProvider"
},
{
"type": "@WebInspector.ActionDelegate",
"actionId": "debugger.toggle-pause",
"className": "WebInspector.SourcesPanel.TogglePauseActionDelegate",
"contextTypes": ["WebInspector.SourcesPanel", "WebInspector.ShortcutRegistry.ForwardedShortcut"],
"bindings": [
{
"platform": "windows,linux",
"shortcut": "F8 Ctrl+\\"
},
{
"platform": "mac",
"shortcut": "F8 Meta+\\"
}
]
},
{
"type": "@WebInspector.SearchScope",
"className": "WebInspector.SourcesSearchScope"
......
......@@ -201,5 +201,14 @@ WebInspector.ShortcutRegistry.prototype = {
}
}
/**
* @constructor
*/
WebInspector.ShortcutRegistry.ForwardedShortcut = function()
{
}
WebInspector.ShortcutRegistry.ForwardedShortcut.instance = new WebInspector.ShortcutRegistry.ForwardedShortcut();
/** @type {!WebInspector.ShortcutRegistry} */
WebInspector.shortcutRegistry;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment