Chromium Code Reviews| Index: Source/devtools/front_end/console/ConsoleView.js |
| diff --git a/Source/devtools/front_end/console/ConsoleView.js b/Source/devtools/front_end/console/ConsoleView.js |
| index bf465f50cec16026ef4359137da0581c744dafa5..31c69dff3c754f63e7683410ec17c21717b4d8a7 100644 |
| --- a/Source/devtools/front_end/console/ConsoleView.js |
| +++ b/Source/devtools/front_end/console/ConsoleView.js |
| @@ -59,7 +59,7 @@ WebInspector.ConsoleView = function() |
| this._regexMatchRanges = []; |
| this._clearConsoleButton = new WebInspector.ToolbarButton(WebInspector.UIString("Clear console log"), "clear-toolbar-item"); |
| - this._clearConsoleButton.addEventListener("click", this._requestClearMessages, this); |
| + this._clearConsoleButton.setAction("console.clear"); |
|
pfeldman
2015/08/17 19:22:49
I think you should build it from the action and if
|
| this._executionContextComboBox = new WebInspector.ToolbarComboBox(null, "console-context"); |
| this._executionContextComboBox.setMaxWidth(200); |
| @@ -579,7 +579,7 @@ WebInspector.ConsoleView.prototype = { |
| unhideAll.setEnabled(hasFilters); |
| contextMenu.appendSeparator(); |
| - contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^console"), this._requestClearMessages.bind(this)); |
| + contextMenu.appendAction(WebInspector.UIString("Clear console"), "console.clear"); |
|
pfeldman
2015/08/17 19:22:49
Like we do to context menus in here.
|
| contextMenu.appendItem(WebInspector.UIString("Save as..."), this._saveConsole.bind(this)); |
| var request = consoleMessage ? consoleMessage.request : null; |
| @@ -708,11 +708,9 @@ WebInspector.ConsoleView.prototype = { |
| var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Console")); |
| var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl); |
| - this._shortcuts[shortcutL.key] = this._requestClearMessages.bind(this); |
| var keys = [shortcutL]; |
| if (WebInspector.isMac()) { |
| var shortcutK = shortcut.makeDescriptor("k", WebInspector.KeyboardShortcut.Modifiers.Meta); |
| - this._shortcuts[shortcutK.key] = this._requestClearMessages.bind(this); |
| keys.unshift(shortcutK); |
| } |
| section.addAlternateKeys(keys, WebInspector.UIString("Clear console")); |
| @@ -746,13 +744,6 @@ WebInspector.ConsoleView.prototype = { |
| this._prompt.setText(""); |
| }, |
| - _requestClearMessages: function() |
| - { |
| - var targets = WebInspector.targetManager.targets(); |
| - for (var i = 0; i < targets.length; ++i) |
| - targets[i].consoleModel.requestClearMessages(); |
| - }, |
| - |
| _promptKeyDown: function(event) |
| { |
| if (isEnterKey(event)) { |
| @@ -1289,11 +1280,11 @@ WebInspector.ConsoleGroup.prototype = { |
| * @constructor |
| * @implements {WebInspector.ActionDelegate} |
| */ |
| -WebInspector.ConsoleView.ShowConsoleActionDelegate = function() |
| +WebInspector.ConsoleView.ActionDelegate = function() |
| { |
| } |
| -WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
| +WebInspector.ConsoleView.ActionDelegate.prototype = { |
| /** |
| * @override |
| * @param {!WebInspector.Context} context |
| @@ -1301,7 +1292,10 @@ WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
| */ |
| handleAction: function(context, actionId) |
| { |
| - WebInspector.console.show(); |
| + if (actionId === "console.show") |
| + WebInspector.console.show(); |
| + else if (actionId === "console.clear") |
| + WebInspector.ConsoleModel.clearConsole(); |
| } |
| } |