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

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

Issue 2837083003: DevTools: create test infrastructure so devtools drives the test (Closed)
Patch Set: Created 3 years, 8 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: 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

Powered by Google App Engine
This is Rietveld 408576698