Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Side by Side Diff: Source/devtools/front_end/ConsoleView.js

Issue 206253005: DevTools: Get rid of WebInspector.ConsoleModel.UIDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 11 matching lines...) Expand all
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 /** 30 /**
31 * @extends {WebInspector.VBox} 31 * @extends {WebInspector.VBox}
32 * @implements {WebInspector.ConsoleModel.UIDelegate}
33 * @implements {WebInspector.Searchable} 32 * @implements {WebInspector.Searchable}
34 * @constructor 33 * @constructor
35 * @param {boolean} hideContextSelector 34 * @param {boolean} hideContextSelector
36 */ 35 */
37 WebInspector.ConsoleView = function(hideContextSelector) 36 WebInspector.ConsoleView = function(hideContextSelector)
38 { 37 {
39 WebInspector.VBox.call(this); 38 WebInspector.VBox.call(this);
40 this.registerRequiredCSS("filter.css"); 39 this.registerRequiredCSS("filter.css");
41 40
42 this._searchableView = new WebInspector.SearchableView(this); 41 this._searchableView = new WebInspector.SearchableView(this);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 this._registerShortcuts(); 93 this._registerShortcuts();
95 this.registerRequiredCSS("textPrompt.css"); 94 this.registerRequiredCSS("textPrompt.css");
96 95
97 this.messagesElement.addEventListener("contextmenu", this._handleContextMenu Event.bind(this), false); 96 this.messagesElement.addEventListener("contextmenu", this._handleContextMenu Event.bind(this), false);
98 97
99 WebInspector.settings.monitoringXHREnabled.addChangeListener(this._monitorin gXHREnabledSettingChanged.bind(this)); 98 WebInspector.settings.monitoringXHREnabled.addChangeListener(this._monitorin gXHREnabledSettingChanged.bind(this));
100 99
101 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.Messa geAdded, this._onConsoleMessageAdded, this); 100 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.Messa geAdded, this._onConsoleMessageAdded, this);
102 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.Conso leCleared, this._consoleCleared, this); 101 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.Conso leCleared, this._consoleCleared, this);
103 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.Repea tCountUpdated, this._repeatCountUpdated, this); 102 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.Repea tCountUpdated, this._repeatCountUpdated, this);
103 WebInspector.console.addEventListener(WebInspector.ConsoleModel.Events.Evalu ationResultMessageAdded, this._printEvaluationResult, this);
vsevik 2014/03/20 13:22:46 this._commandEvaluated
sergeyv 2014/03/20 13:34:03 Done.
104 104
105 this._linkifier = new WebInspector.Linkifier(); 105 this._linkifier = new WebInspector.Linkifier();
106 106
107 /** @type {!Map.<!WebInspector.ConsoleMessage, !WebInspector.ConsoleViewMess age>} */ 107 /** @type {!Map.<!WebInspector.ConsoleMessage, !WebInspector.ConsoleViewMess age>} */
108 this._messageToViewMessage = new Map(); 108 this._messageToViewMessage = new Map();
109 /** @type {!Array.<!WebInspector.ConsoleMessage>} */ 109 /** @type {!Array.<!WebInspector.ConsoleMessage>} */
110 this._consoleMessages = []; 110 this._consoleMessages = [];
111 111
112 this.prompt = new WebInspector.TextPromptWithHistory(WebInspector.runtimeMod el.completionsForTextPrompt.bind(WebInspector.runtimeModel)); 112 this.prompt = new WebInspector.TextPromptWithHistory(WebInspector.runtimeMod el.completionsForTextPrompt.bind(WebInspector.runtimeModel));
113 this.prompt.setSuggestBoxEnabled("generic-suggest"); 113 this.prompt.setSuggestBoxEnabled("generic-suggest");
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 if (event.altKey || event.ctrlKey || event.shiftKey) 663 if (event.altKey || event.ctrlKey || event.shiftKey)
664 return; 664 return;
665 665
666 event.consume(true); 666 event.consume(true);
667 667
668 this.prompt.clearAutoComplete(true); 668 this.prompt.clearAutoComplete(true);
669 669
670 var str = this.prompt.text; 670 var str = this.prompt.text;
671 if (!str.length) 671 if (!str.length)
672 return; 672 return;
673 this._appendCommand(str, "", true); 673 this._appendCommand(str, true);
674 }, 674 },
675 675
676 /** 676 /**
677 * @param {?WebInspector.RemoteObject} result 677 * @param {?WebInspector.RemoteObject} result
678 * @param {boolean} wasThrown 678 * @param {boolean} wasThrown
679 * @param {?WebInspector.ConsoleCommand} originatingCommand 679 * @param {?WebInspector.ConsoleCommand} originatingCommand
680 */ 680 */
681 _printResult: function(result, wasThrown, originatingCommand) 681 _printResult: function(result, wasThrown, originatingCommand)
682 { 682 {
683 if (!result) 683 if (!result)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 url = script.sourceURL; 724 url = script.sourceURL;
725 lineNumber = response.location.lineNumber + 1; 725 lineNumber = response.location.lineNumber + 1;
726 columnNumber = response.location.columnNumber + 1; 726 columnNumber = response.location.columnNumber + 1;
727 } 727 }
728 addMessage.call(this, url, lineNumber, columnNumber); 728 addMessage.call(this, url, lineNumber, columnNumber);
729 } 729 }
730 }, 730 },
731 731
732 /** 732 /**
733 * @param {string} text 733 * @param {string} text
734 * @param {string} newPromptText
735 * @param {boolean} useCommandLineAPI 734 * @param {boolean} useCommandLineAPI
736 */ 735 */
737 _appendCommand: function(text, newPromptText, useCommandLineAPI) 736 _appendCommand: function(text, useCommandLineAPI)
738 { 737 {
739 WebInspector.console.evaluateCommand(text, newPromptText, useCommandLine API); 738 this.prompt.text = "";
739 WebInspector.console.evaluateCommand(text, useCommandLineAPI);
740 }, 740 },
741 741
742 /** 742 /**
743 * @override 743 * @param {!WebInspector.Event} event
744 * @param {string} text
745 */ 744 */
746 setPromptText: function(text) 745 _printEvaluationResult: function(event)
747 { 746 {
748 this.prompt.text = text; 747 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data);
748 this.prompt.pushHistoryItem(data.text);
749 WebInspector.settings.consoleHistory.set(this.prompt.historyData.slice(- 30));
750 this._printResult(data.result, data.wasThrown, /** @type {!WebInspector. ConsoleCommand} */ (this._messageToViewMessage.get(data.commandMessage)));
749 }, 751 },
750 752
751 /** 753 /**
752 * @override
753 * @param {?WebInspector.RemoteObject} result
754 * @param {boolean} wasThrown
755 * @param {string} promptText
756 * @param {!WebInspector.ConsoleMessage} commandMessage
757 */
758 printEvaluationResult: function(result, wasThrown, promptText, commandMessag e)
759 {
760 this.prompt.pushHistoryItem(promptText);
761 WebInspector.settings.consoleHistory.set(this.prompt.historyData.slice(- 30));
762 this._printResult(result, wasThrown, /** @type {!WebInspector.ConsoleCom mand} */ (this._messageToViewMessage.get(commandMessage)));
763 },
764
765 /**
766 * @return {!Array.<!Element>} 754 * @return {!Array.<!Element>}
767 */ 755 */
768 elementsToRestoreScrollPositionsFor: function() 756 elementsToRestoreScrollPositionsFor: function()
769 { 757 {
770 return [this.messagesElement]; 758 return [this.messagesElement];
771 }, 759 },
772 760
773 searchCanceled: function() 761 searchCanceled: function()
774 { 762 {
775 this._clearCurrentSearchResultHighlight(); 763 this._clearCurrentSearchResultHighlight();
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 var node = this.messagesElement.firstChild; 1133 var node = this.messagesElement.firstChild;
1146 while (node) { 1134 while (node) {
1147 if (node.classList.contains("console-message") && node.message) 1135 if (node.classList.contains("console-message") && node.message)
1148 node.message.wasShown(); 1136 node.message.wasShown();
1149 if (node.classList.contains("console-group") && node.group) 1137 if (node.classList.contains("console-group") && node.group)
1150 node.group.wasShown(); 1138 node.group.wasShown();
1151 node = node.nextSibling; 1139 node = node.nextSibling;
1152 } 1140 }
1153 } 1141 }
1154 } 1142 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698