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

Unified Diff: content/shell/browser/shell_devtools_frontend.cc

Issue 870883008: Test runner: make inspector tests reuse a single inspector process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing Created 5 years, 11 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
« no previous file with comments | « content/shell/browser/shell_devtools_frontend.h ('k') | content/shell/browser/webkit_test_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/shell_devtools_frontend.cc
diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc
index 42ffa70e0354b191cbc11bb62c2a5d5ba100f8a6..a6bead64ffbe3ae8ddf232723c8ef1e70c7e4117 100644
--- a/content/shell/browser/shell_devtools_frontend.cc
+++ b/content/shell/browser/shell_devtools_frontend.cc
@@ -60,13 +60,21 @@ void ShellDevToolsFrontend::Focus() {
}
void ShellDevToolsFrontend::InspectElementAt(int x, int y) {
- agent_host_->InspectElement(x, y);
+ if (agent_host_)
+ agent_host_->InspectElement(x, y);
}
void ShellDevToolsFrontend::Close() {
frontend_shell_->Close();
}
+void ShellDevToolsFrontend::DisconnectFromTarget() {
+ if (!agent_host_)
+ return;
+ agent_host_->DetachClient();
+ agent_host_ = NULL;
+}
+
ShellDevToolsFrontend::ShellDevToolsFrontend(Shell* frontend_shell,
DevToolsAgentHost* agent_host)
: WebContentsObserver(frontend_shell->web_contents()),
@@ -82,17 +90,26 @@ void ShellDevToolsFrontend::RenderViewCreated(
if (!frontend_host_) {
frontend_host_.reset(
DevToolsFrontendHost::Create(web_contents()->GetMainFrame(), this));
- agent_host_->AttachClient(this);
}
}
+void ShellDevToolsFrontend::DidNavigateMainFrame(
+ const LoadCommittedDetails& details,
+ const FrameNavigateParams& params) {
+ if (agent_host_)
+ agent_host_->AttachClient(this);
+}
+
void ShellDevToolsFrontend::WebContentsDestroyed() {
- agent_host_->DetachClient();
+ if (agent_host_)
+ agent_host_->DetachClient();
delete this;
}
void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend(
const std::string& message) {
+ if (!agent_host_)
+ return;
std::string method;
int id = 0;
base::ListValue* params = NULL;
@@ -127,7 +144,8 @@ void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend(
void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend(
const std::string& message) {
- agent_host_->DispatchProtocolMessage(message);
+ if (agent_host_)
+ agent_host_->DispatchProtocolMessage(message);
}
void ShellDevToolsFrontend::DispatchProtocolMessage(
@@ -151,6 +169,11 @@ void ShellDevToolsFrontend::DispatchProtocolMessage(
}
}
+void ShellDevToolsFrontend::AttachTo(WebContents* inspected_contents) {
+ DisconnectFromTarget();
+ agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents);
+}
+
void ShellDevToolsFrontend::AgentHostClosed(
DevToolsAgentHost* agent_host, bool replaced) {
frontend_shell_->Close();
« no previous file with comments | « content/shell/browser/shell_devtools_frontend.h ('k') | content/shell/browser/webkit_test_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698