Index: content/shell/browser/shell_devtools_bindings.cc |
diff --git a/content/shell/browser/shell_devtools_bindings.cc b/content/shell/browser/shell_devtools_bindings.cc |
index 77bfc75a95bed31056a00181e54bd7013ddced47..88ab2042f0cf1b8246b6314a5eba94ed3d6b7943 100644 |
--- a/content/shell/browser/shell_devtools_bindings.cc |
+++ b/content/shell/browser/shell_devtools_bindings.cc |
@@ -15,6 +15,7 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "base/values.h" |
#include "content/public/browser/browser_thread.h" |
+#include "content/public/browser/navigation_handle.h" |
#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/storage_partition.h" |
@@ -128,19 +129,20 @@ ShellDevToolsBindings::~ShellDevToolsBindings() { |
agent_host_->DetachClient(this); |
} |
-void ShellDevToolsBindings::RenderViewCreated( |
- RenderViewHost* render_view_host) { |
- CreateFrontendHost(); |
+void ShellDevToolsBindings::ReadyToCommitNavigation( |
+ content::NavigationHandle* navigation_handle) { |
+ if (navigation_handle->IsInMainFrame()) { |
+ CreateFrontendHost(navigation_handle->GetRenderFrameHost()); |
+ } |
} |
#if !defined(OS_ANDROID) |
-void ShellDevToolsBindings::CreateFrontendHost() { |
- if (!frontend_host_) { |
- frontend_host_.reset(DevToolsFrontendHost::Create( |
- web_contents()->GetMainFrame(), |
- base::Bind(&ShellDevToolsBindings::HandleMessageFromDevToolsFrontend, |
- base::Unretained(this)))); |
- } |
+void ShellDevToolsBindings::CreateFrontendHost( |
+ RenderFrameHost* render_frame_host) { |
+ frontend_host_.reset(DevToolsFrontendHost::Create( |
+ render_frame_host, |
+ base::Bind(&ShellDevToolsBindings::HandleMessageFromDevToolsFrontend, |
+ base::Unretained(this)))); |
} |
#endif |