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 2b11e8eaa2481f35fdc17a584788e4a4e6ff16de..e916e071f927c7c63233f1950f245509f3dec42d 100644 |
--- a/content/shell/browser/shell_devtools_frontend.cc |
+++ b/content/shell/browser/shell_devtools_frontend.cc |
@@ -11,7 +11,6 @@ |
#include "base/strings/stringprintf.h" |
#include "base/strings/utf_string_conversions.h" |
#include "content/public/browser/devtools_http_handler.h" |
-#include "content/public/browser/devtools_manager.h" |
#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/web_contents.h" |
@@ -117,8 +116,7 @@ void ShellDevToolsFrontend::RenderViewCreated( |
RenderViewHost* render_view_host) { |
if (!frontend_host_) { |
frontend_host_.reset(DevToolsFrontendHost::Create(render_view_host, this)); |
- DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor( |
- agent_host_.get(), this); |
+ agent_host_->AttachClient(this); |
} |
} |
@@ -128,7 +126,7 @@ void ShellDevToolsFrontend::DocumentOnLoadCompletedInMainFrame() { |
} |
void ShellDevToolsFrontend::WebContentsDestroyed() { |
- DevToolsManager::GetInstance()->ClientHostClosing(this); |
+ agent_host_->DetachClient(); |
delete this; |
} |
@@ -160,8 +158,7 @@ void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( |
} |
dict->GetInteger("id", &id); |
- DevToolsManager::GetInstance()->DispatchOnInspectorBackend( |
- this, browser_message); |
+ agent_host_->DispatchOnInspectorBackend(browser_message); |
if (id) { |
std::string code = "InspectorFrontendAPI.embedderMessageAck(" + |
@@ -173,19 +170,21 @@ void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( |
void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontendToBackend( |
const std::string& message) { |
- DevToolsManager::GetInstance()->DispatchOnInspectorBackend( |
- this, message); |
+ agent_host_->DispatchOnInspectorBackend(message); |
} |
-void ShellDevToolsFrontend::DispatchOnInspectorFrontend( |
- const std::string& message) { |
+void ShellDevToolsFrontend::SendMessageFromAgentHost( |
+ DevToolsAgentHost* agent_host, const std::string& message) { |
std::string code = "InspectorFrontendAPI.dispatchMessage(" + message + ");"; |
base::string16 javascript = base::UTF8ToUTF16(code); |
web_contents()->GetMainFrame()->ExecuteJavaScript(javascript); |
} |
-void ShellDevToolsFrontend::InspectedContentsClosing() { |
- frontend_shell_->Close(); |
+void ShellDevToolsFrontend::AgentHostDetached( |
+ DevToolsAgentHost* agent_host, DevToolsAgentHost::DetachReason reason) { |
+ DCHECK(agent_host == agent_host_.get()); |
+ if (reason != DevToolsAgentHost::DETACHED_BY_CLIENT) |
+ frontend_shell_->Close(); |
} |
} // namespace content |