Commit 89d016a1 authored by sergeyv@chromium.org's avatar sergeyv@chromium.org

DevTools: Get rid of WebInspector.ConsoleModel.UIDelegate

BUG=

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169667 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 21dca92f
......@@ -35,7 +35,7 @@ function test()
InspectorTest.runTestSuite([
function testRevealElement(next)
{
InspectorTest.addSniffer(WebInspector.Revealer, "reveal", step2);
InspectorTest.addSniffer(WebInspector.Revealer, "reveal", step2, true);
evalAndDump("inspect($('#p1'))");
function step2(node)
......
......@@ -12,7 +12,7 @@ function testFunction()
var test = function()
{
InspectorTest.addSniffer(WebInspector.Main.prototype, "inspect", inspect);
InspectorTest.addSniffer(WebInspector.Revealer, "reveal", updateFocusedNode);
InspectorTest.addSniffer(WebInspector.Revealer, "reveal", updateFocusedNode, true);
function updateFocusedNode(node)
{
......
......@@ -46,9 +46,10 @@ WebInspector.ConsoleModel = function(target)
}
WebInspector.ConsoleModel.Events = {
ConsoleCleared: "console-cleared",
MessageAdded: "console-message-added",
RepeatCountUpdated: "repeat-count-updated"
ConsoleCleared: "ConsoleCleared",
MessageAdded: "MessageAdded",
RepeatCountUpdated: "RepeatCountUpdated",
CommandEvaluated: "CommandEvaluated",
}
WebInspector.ConsoleModel.prototype = {
......@@ -77,14 +78,6 @@ WebInspector.ConsoleModel.prototype = {
return !!this._enablingConsole;
},
/**
* @param {!WebInspector.ConsoleModel.UIDelegate} delegate
*/
setUIDelegate: function(delegate)
{
this._uiDelegate = delegate;
},
/**
* @param {!WebInspector.ConsoleMessage} msg
* @param {boolean=} isFromBackend
......@@ -108,20 +101,15 @@ WebInspector.ConsoleModel.prototype = {
/**
* @param {string} text
* @param {?string} newPromptText
* @param {boolean} useCommandLineAPI
*/
evaluateCommand: function(text, newPromptText, useCommandLineAPI)
evaluateCommand: function(text, useCommandLineAPI)
{
if (!this._uiDelegate)
this.show();
var commandMessage = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.JS, null, text, WebInspector.ConsoleMessage.MessageType.Command);
this.addMessage(commandMessage);
if (newPromptText !== null)
this._uiDelegate.setPromptText(newPromptText);
/**
* @param {?WebInspector.RemoteObject} result
* @param {boolean} wasThrown
......@@ -133,7 +121,7 @@ WebInspector.ConsoleModel.prototype = {
if (!result)
return;
this._uiDelegate.printEvaluationResult(result, wasThrown, text, commandMessage);
this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated, {result: result, wasThrown: wasThrown, text: text, commandMessage: commandMessage});
}
this._target.runtimeModel.evaluate(text, "console", useCommandLineAPI, false, false, true, printResult.bind(this));
......@@ -150,7 +138,7 @@ WebInspector.ConsoleModel.prototype = {
*/
evaluate: function(expression)
{
this.evaluateCommand(expression, null, false);
this.evaluateCommand(expression, false);
},
/**
......@@ -240,26 +228,6 @@ WebInspector.ConsoleModel.prototype = {
__proto__: WebInspector.Object.prototype
}
/**
* @interface
*/
WebInspector.ConsoleModel.UIDelegate = function() { }
WebInspector.ConsoleModel.UIDelegate.prototype = {
/**
* @param {string} text
*/
setPromptText: function(text) { },
/**
* @param {?WebInspector.RemoteObject} result
* @param {boolean} wasThrown
* @param {string} promptText
* @param {!WebInspector.ConsoleMessage} commandMessage
*/
printEvaluationResult: function(result, wasThrown, promptText, commandMessage) { }
}
/**
* @constructor
* @param {string} source
......
......@@ -44,10 +44,9 @@ WebInspector.ConsolePanel = function()
*/
WebInspector.ConsolePanel._view = function()
{
if (!WebInspector.ConsolePanel._consoleView) {
if (!WebInspector.ConsolePanel._consoleView)
WebInspector.ConsolePanel._consoleView = new WebInspector.ConsoleView(!Capabilities.isMainFrontend);
WebInspector.console.setUIDelegate(WebInspector.ConsolePanel._consoleView);
}
return WebInspector.ConsolePanel._consoleView;
}
......
......@@ -29,7 +29,6 @@
/**
* @extends {WebInspector.VBox}
* @implements {WebInspector.ConsoleModel.UIDelegate}
* @implements {WebInspector.Searchable}
* @constructor
* @param {boolean} hideContextSelector
......@@ -101,6 +100,7 @@ WebInspector.ConsoleView = function(hideContextSelector)
WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, this._onConsoleMessageAdded, this);
WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.ConsoleCleared, this._consoleCleared, this);
WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated, this._repeatCountUpdated, this);
WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.CommandEvaluated, this._commandEvaluated, this);
this._linkifier = new WebInspector.Linkifier();
......@@ -670,7 +670,7 @@ WebInspector.ConsoleView.prototype = {
var str = this.prompt.text;
if (!str.length)
return;
this._appendCommand(str, "", true);
this._appendCommand(str, true);
},
/**
......@@ -731,35 +731,23 @@ WebInspector.ConsoleView.prototype = {
/**
* @param {string} text
* @param {string} newPromptText
* @param {boolean} useCommandLineAPI
*/
_appendCommand: function(text, newPromptText, useCommandLineAPI)
_appendCommand: function(text, useCommandLineAPI)
{
WebInspector.console.evaluateCommand(text, newPromptText, useCommandLineAPI);
this.prompt.text = "";
WebInspector.console.evaluateCommand(text, useCommandLineAPI);
},
/**
* @override
* @param {string} text
*/
setPromptText: function(text)
{
this.prompt.text = text;
},
/**
* @override
* @param {?WebInspector.RemoteObject} result
* @param {boolean} wasThrown
* @param {string} promptText
* @param {!WebInspector.ConsoleMessage} commandMessage
* @param {!WebInspector.Event} event
*/
printEvaluationResult: function(result, wasThrown, promptText, commandMessage)
_commandEvaluated: function(event)
{
this.prompt.pushHistoryItem(promptText);
var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data);
this.prompt.pushHistoryItem(data.text);
WebInspector.settings.consoleHistory.set(this.prompt.historyData.slice(-30));
this._printResult(result, wasThrown, /** @type {!WebInspector.ConsoleCommand} */ (this._messageToViewMessage.get(commandMessage)));
this._printResult(data.result, data.wasThrown, /** @type {!WebInspector.ConsoleCommand} */ (this._messageToViewMessage.get(data.commandMessage)));
},
/**
......
......@@ -111,7 +111,6 @@ WebInspector.JavaScriptSourceFrame.prototype = {
*/
_evaluateInConsole: function(expression)
{
WebInspector.console.show();
WebInspector.console.evaluate(expression);
},
......
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