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 07c97e5f2c469962c35304b32a526238bf4722dd..05e26a5700c66eca83442e964ec2507ef8a13e2d 100644 |
| --- a/Source/devtools/front_end/console/ConsoleView.js |
| +++ b/Source/devtools/front_end/console/ConsoleView.js |
| @@ -140,6 +140,7 @@ WebInspector.ConsoleView = function(hideContextSelector) |
| this._registerWithMessageSink(); |
| WebInspector.targetManager.observeTargets(this); |
| + 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.
|
| } |
| WebInspector.ConsoleView.prototype = { |
| @@ -318,6 +319,8 @@ WebInspector.ConsoleView.prototype = { |
| } |
| } |
| this._executionContextSelector.selectElement().insertBefore(newOption, insertBeforeOption); |
| + if (executionContext === WebInspector.executionContextSelector.currentExecutionContext()) |
| + this._executionContextSelector.select(newOption); |
| }, |
| /** |
| @@ -333,13 +336,28 @@ WebInspector.ConsoleView.prototype = { |
| _executionContextChanged: function() |
| { |
| var newContext = this._currentExecutionContext(); |
| - WebInspector.context.setFlavor(WebInspector.ExecutionContext, newContext); |
| + WebInspector.executionContextSelector.setCurrentExecutionContext(newContext); |
| this._prompt.clearAutoComplete(true); |
| if (!this._showAllMessagesCheckbox.checked()) |
| this._updateMessageList(); |
| }, |
| /** |
| + * @param {?WebInspector.ExecutionContext} executionContext |
| + */ |
| + _executionContextExternallyChanged: function(executionContext) |
| + { |
| + if (!executionContext) |
| + return; |
| + |
| + var options = this._executionContextSelector.selectElement().options; |
| + for (var i = 0; i < options.length; ++i) { |
| + if (options[i].__executionContext === executionContext) |
| + this._executionContextSelector.select(options[i]); |
| + } |
| + }, |
| + |
| + /** |
| * @return {?WebInspector.ExecutionContext} |
| */ |
| _currentExecutionContext: function() |
| @@ -808,7 +826,7 @@ WebInspector.ConsoleView.prototype = { |
| { |
| this._prompt.text = ""; |
| - var currentExecutionContext = WebInspector.context.flavor(WebInspector.ExecutionContext); |
| + var currentExecutionContext = WebInspector.executionContextSelector.currentExecutionContext(); |
| if (currentExecutionContext) |
| WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecutionContext, text, useCommandLineAPI); |
| }, |
| @@ -979,7 +997,7 @@ WebInspector.ConsoleViewFilter.prototype = { |
| shouldBeVisible: function(viewMessage) |
| { |
| var message = viewMessage.consoleMessage(); |
| - var executionContext = WebInspector.context.flavor(WebInspector.ExecutionContext); |
| + var executionContext = WebInspector.executionContextSelector.currentExecutionContext(); |
| if (!message.target()) |
| return true; |