Chromium Code Reviews| Index: content/browser/devtools/render_frame_devtools_agent_host.cc |
| diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc |
| index 6646dcdbf47c312cb9b59f53c6a4341c49b66388..b78c7ba41bfbccb52b3ac6d9f987e71c00692773 100644 |
| --- a/content/browser/devtools/render_frame_devtools_agent_host.cc |
| +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc |
| @@ -13,6 +13,7 @@ |
| #include "content/browser/child_process_security_policy_impl.h" |
| #include "content/browser/devtools/devtools_frame_trace_recorder.h" |
| #include "content/browser/devtools/devtools_protocol_handler.h" |
| +#include "content/browser/devtools/page_navigation_throttle.h" |
| #include "content/browser/devtools/protocol/browser_handler.h" |
| #include "content/browser/devtools/protocol/dom_handler.h" |
| #include "content/browser/devtools/protocol/emulation_handler.h" |
| @@ -345,6 +346,24 @@ void RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
| agent_host->AboutToNavigate(navigation_handle); |
| } |
| +// static |
| +std::unique_ptr<NavigationThrottle> |
| +RenderFrameDevToolsAgentHost::GetThrottleForNavigation( |
| + NavigationHandle* navigation_handle) { |
| + FrameTreeNode* frame_tree_node = |
| + static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); |
| + RenderFrameHost* frame_host = frame_tree_node->current_frame_host(); |
|
dgozman
2016/07/09 01:57:00
Could there be no current frame host? Let's instea
alex clarke (OOO till 29th)
2016/07/11 09:25:19
Done.
|
| + while (frame_host && !ShouldCreateDevToolsFor(frame_host)) |
| + frame_host = frame_host->GetParent(); |
| + DCHECK(frame_host); |
| + RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_host); |
| + if (agent_host && agent_host->page_handler_) { |
| + return agent_host->page_handler_->GetThrottleForNavigation( |
| + navigation_handle); |
| + } |
| + return nullptr; |
| +} |
| + |
| RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( |
| RenderFrameHostImpl* host) |
| : browser_handler_(new devtools::browser::BrowserHandler()), |