Chromium Code Reviews| Index: content/browser/devtools/devtools_frontend_host_impl.cc |
| diff --git a/content/browser/devtools/devtools_frontend_host_impl.cc b/content/browser/devtools/devtools_frontend_host_impl.cc |
| index 9c101d26b87b0b542c74f372d72dd6820a6262a0..1d4aa95bf61a3def529392d98b873561d5d1eb6c 100644 |
| --- a/content/browser/devtools/devtools_frontend_host_impl.cc |
| +++ b/content/browser/devtools/devtools_frontend_host_impl.cc |
| @@ -7,6 +7,8 @@ |
| #include <stddef.h> |
| #include "content/browser/bad_message.h" |
| +#include "content/browser/frame_host/frame_tree.h" |
| +#include "content/browser/web_contents/web_contents_impl.h" |
| #include "content/common/devtools_messages.h" |
| #include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/render_frame_host.h" |
| @@ -25,9 +27,13 @@ const char kCompatibilityScriptSourceURL[] = |
| // static |
| DevToolsFrontendHost* DevToolsFrontendHost::Create( |
| - RenderFrameHost* frontend_main_frame, |
| + WebContents* web_contents, |
| const HandleMessageCallback& handle_message_callback) { |
| - return new DevToolsFrontendHostImpl(frontend_main_frame, |
| + RenderFrameHost* frame = web_contents->GetMainFrame(); |
| + FrameTree* tree = static_cast<WebContentsImpl*>(web_contents)->GetFrameTree(); |
| + RenderFrameHostManager* rfhm = tree->root()->render_manager(); |
| + RenderFrameHost* pending_frame = rfhm->pending_frame_host(); |
| + return new DevToolsFrontendHostImpl(pending_frame ? pending_frame : frame, |
|
pfeldman
2017/01/10 22:31:51
This looks fragile and implementation implies navi
|
| handle_message_callback); |
| } |