Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 this._prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bi nd(this), false); | 133 this._prompt.proxyElement.addEventListener("keydown", this._promptKeyDown.bi nd(this), false); |
| 134 this._prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); | 134 this._prompt.setHistoryData(WebInspector.settings.consoleHistory.get()); |
| 135 var historyData = WebInspector.settings.consoleHistory.get(); | 135 var historyData = WebInspector.settings.consoleHistory.get(); |
| 136 this._prompt.setHistoryData(historyData); | 136 this._prompt.setHistoryData(historyData); |
| 137 | 137 |
| 138 this._updateFilterStatus(); | 138 this._updateFilterStatus(); |
| 139 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._conso leTimestampsSettingChanged, this); | 139 WebInspector.settings.consoleTimestampsEnabled.addChangeListener(this._conso leTimestampsSettingChanged, this); |
| 140 | 140 |
| 141 this._registerWithMessageSink(); | 141 this._registerWithMessageSink(); |
| 142 WebInspector.targetManager.observeTargets(this); | 142 WebInspector.targetManager.observeTargets(this); |
| 143 WebInspector.executionContextSelector.addExecutionContextChangeListener(this ._executionContextExternallyChanged, this); | |
|
vsevik
2014/06/18 12:41:32
Let's make all components use WebInspector.context
sergeyv
2014/06/18 16:50:08
Done.
| |
| 143 } | 144 } |
| 144 | 145 |
| 145 WebInspector.ConsoleView.prototype = { | 146 WebInspector.ConsoleView.prototype = { |
| 146 /** | 147 /** |
| 147 * @return {number} | 148 * @return {number} |
| 148 */ | 149 */ |
| 149 itemCount: function() | 150 itemCount: function() |
| 150 { | 151 { |
| 151 return this._visibleViewMessages.length; | 152 return this._visibleViewMessages.length; |
| 152 }, | 153 }, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 for (var i = 0; i < options.length; ++i) { | 312 for (var i = 0; i < options.length; ++i) { |
| 312 var optionContext = options[i].__executionContext; | 313 var optionContext = options[i].__executionContext; |
| 313 var isSameGroup = executionContext.target() === optionContext.target () && executionContext.frameId === optionContext.frameId; | 314 var isSameGroup = executionContext.target() === optionContext.target () && executionContext.frameId === optionContext.frameId; |
| 314 sameGroupExists |= isSameGroup; | 315 sameGroupExists |= isSameGroup; |
| 315 if ((isSameGroup && WebInspector.ExecutionContext.comparator(optionC ontext, executionContext) > 0) || (sameGroupExists && !isSameGroup)) { | 316 if ((isSameGroup && WebInspector.ExecutionContext.comparator(optionC ontext, executionContext) > 0) || (sameGroupExists && !isSameGroup)) { |
| 316 insertBeforeOption = options[i]; | 317 insertBeforeOption = options[i]; |
| 317 break; | 318 break; |
| 318 } | 319 } |
| 319 } | 320 } |
| 320 this._executionContextSelector.selectElement().insertBefore(newOption, i nsertBeforeOption); | 321 this._executionContextSelector.selectElement().insertBefore(newOption, i nsertBeforeOption); |
| 322 if (executionContext === WebInspector.executionContextSelector.currentEx ecutionContext()) | |
| 323 this._executionContextSelector.select(newOption); | |
| 321 }, | 324 }, |
| 322 | 325 |
| 323 /** | 326 /** |
| 324 * @param {!WebInspector.Event} event | 327 * @param {!WebInspector.Event} event |
| 325 */ | 328 */ |
| 326 _onExecutionContextDestroyed: function(event) | 329 _onExecutionContextDestroyed: function(event) |
| 327 { | 330 { |
| 328 var executionContext = /** @type {!WebInspector.ExecutionContext} */ (ev ent.data); | 331 var executionContext = /** @type {!WebInspector.ExecutionContext} */ (ev ent.data); |
| 329 var option = this._optionByExecutionContext.remove(executionContext); | 332 var option = this._optionByExecutionContext.remove(executionContext); |
| 330 option.remove(); | 333 option.remove(); |
| 331 }, | 334 }, |
| 332 | 335 |
| 333 _executionContextChanged: function() | 336 _executionContextChanged: function() |
| 334 { | 337 { |
| 335 var newContext = this._currentExecutionContext(); | 338 var newContext = this._currentExecutionContext(); |
| 336 WebInspector.context.setFlavor(WebInspector.ExecutionContext, newContext ); | 339 WebInspector.executionContextSelector.setCurrentExecutionContext(newCont ext); |
| 337 this._prompt.clearAutoComplete(true); | 340 this._prompt.clearAutoComplete(true); |
| 338 if (!this._showAllMessagesCheckbox.checked()) | 341 if (!this._showAllMessagesCheckbox.checked()) |
| 339 this._updateMessageList(); | 342 this._updateMessageList(); |
| 340 }, | 343 }, |
| 341 | 344 |
| 342 /** | 345 /** |
| 346 * @param {?WebInspector.ExecutionContext} executionContext | |
| 347 */ | |
| 348 _executionContextExternallyChanged: function(executionContext) | |
| 349 { | |
| 350 if (!executionContext) | |
| 351 return; | |
| 352 | |
| 353 var options = this._executionContextSelector.selectElement().options; | |
| 354 for (var i = 0; i < options.length; ++i) { | |
| 355 if (options[i].__executionContext === executionContext) | |
| 356 this._executionContextSelector.select(options[i]); | |
| 357 } | |
| 358 }, | |
| 359 | |
| 360 /** | |
| 343 * @return {?WebInspector.ExecutionContext} | 361 * @return {?WebInspector.ExecutionContext} |
| 344 */ | 362 */ |
| 345 _currentExecutionContext: function() | 363 _currentExecutionContext: function() |
| 346 { | 364 { |
| 347 var option = this._executionContextSelector.selectedOption(); | 365 var option = this._executionContextSelector.selectedOption(); |
| 348 return option ? option.__executionContext : null; | 366 return option ? option.__executionContext : null; |
| 349 }, | 367 }, |
| 350 | 368 |
| 351 willHide: function() | 369 willHide: function() |
| 352 { | 370 { |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 }, | 819 }, |
| 802 | 820 |
| 803 /** | 821 /** |
| 804 * @param {string} text | 822 * @param {string} text |
| 805 * @param {boolean} useCommandLineAPI | 823 * @param {boolean} useCommandLineAPI |
| 806 */ | 824 */ |
| 807 _appendCommand: function(text, useCommandLineAPI) | 825 _appendCommand: function(text, useCommandLineAPI) |
| 808 { | 826 { |
| 809 | 827 |
| 810 this._prompt.text = ""; | 828 this._prompt.text = ""; |
| 811 var currentExecutionContext = WebInspector.context.flavor(WebInspector.E xecutionContext); | 829 var currentExecutionContext = WebInspector.executionContextSelector.curr entExecutionContext(); |
| 812 if (currentExecutionContext) | 830 if (currentExecutionContext) |
| 813 WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecutionC ontext, text, useCommandLineAPI); | 831 WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecutionC ontext, text, useCommandLineAPI); |
| 814 }, | 832 }, |
| 815 | 833 |
| 816 /** | 834 /** |
| 817 * @param {!WebInspector.Event} event | 835 * @param {!WebInspector.Event} event |
| 818 */ | 836 */ |
| 819 _commandEvaluated: function(event) | 837 _commandEvaluated: function(event) |
| 820 { | 838 { |
| 821 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data); | 839 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 972 return this._messageURLFilters; | 990 return this._messageURLFilters; |
| 973 }, | 991 }, |
| 974 | 992 |
| 975 /** | 993 /** |
| 976 * @param {!WebInspector.ConsoleViewMessage} viewMessage | 994 * @param {!WebInspector.ConsoleViewMessage} viewMessage |
| 977 * @return {boolean} | 995 * @return {boolean} |
| 978 */ | 996 */ |
| 979 shouldBeVisible: function(viewMessage) | 997 shouldBeVisible: function(viewMessage) |
| 980 { | 998 { |
| 981 var message = viewMessage.consoleMessage(); | 999 var message = viewMessage.consoleMessage(); |
| 982 var executionContext = WebInspector.context.flavor(WebInspector.Executio nContext); | 1000 var executionContext = WebInspector.executionContextSelector.currentExec utionContext(); |
| 983 if (!message.target()) | 1001 if (!message.target()) |
| 984 return true; | 1002 return true; |
| 985 | 1003 |
| 986 if (!this._view._showAllMessagesCheckbox.checked() && executionContext & & (message.target() !== executionContext.target() || message.executionContextId !== executionContext.id)) | 1004 if (!this._view._showAllMessagesCheckbox.checked() && executionContext & & (message.target() !== executionContext.target() || message.executionContextId !== executionContext.id)) |
| 987 return false; | 1005 return false; |
| 988 | 1006 |
| 989 if (viewMessage.consoleMessage().isGroupMessage()) | 1007 if (viewMessage.consoleMessage().isGroupMessage()) |
| 990 return true; | 1008 return true; |
| 991 | 1009 |
| 992 if (message.type === WebInspector.ConsoleMessage.MessageType.Result || m essage.type === WebInspector.ConsoleMessage.MessageType.Command) | 1010 if (message.type === WebInspector.ConsoleMessage.MessageType.Result || m essage.type === WebInspector.ConsoleMessage.MessageType.Command) |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1186 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { | 1204 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { |
| 1187 /** | 1205 /** |
| 1188 * @return {boolean} | 1206 * @return {boolean} |
| 1189 */ | 1207 */ |
| 1190 handleAction: function() | 1208 handleAction: function() |
| 1191 { | 1209 { |
| 1192 WebInspector.console.show(); | 1210 WebInspector.console.show(); |
| 1193 return true; | 1211 return true; |
| 1194 } | 1212 } |
| 1195 } | 1213 } |
| OLD | NEW |