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

Unified Diff: Source/devtools/front_end/console/ConsoleView.js

Issue 338283004: DevTools: Use TargetsToolbar instead of ThreadToolbar (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698