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 a22158bbfd509b7e5500cdf0b570b68ae76ca881..afe8c03983e91a3fb0f9654da5ed2b88bb65c3ec 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,26 @@ void RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
| agent_host->AboutToNavigate(navigation_handle); |
| } |
| +// static |
| +std::unique_ptr<NavigationThrottle> |
| +RenderFrameDevToolsAgentHost::CreateThrottleForNavigation( |
| + NavigationHandle* navigation_handle) { |
| + FrameTreeNode* frame_tree_node = |
| + static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); |
| + while (frame_tree_node && frame_tree_node->parent()) { |
| + frame_tree_node = frame_tree_node->parent(); |
| + } |
| + RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); |
| + // NOTE Page.setControlNavigations is intended to control navigations in the |
|
nasko
2016/07/14 16:47:20
minor nit: "Note: ..."
alex clarke (OOO till 29th)
2016/07/14 17:26:17
Done.
|
| + // main frame and all child frames and |page_handler_| only exists for the |
| + // main frame. |
| + if (agent_host && agent_host->page_handler_) { |
| + return agent_host->page_handler_->CreateThrottleForNavigation( |
| + navigation_handle); |
| + } |
| + return nullptr; |
| +} |
| + |
| RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( |
| RenderFrameHostImpl* host) |
| : browser_handler_(new devtools::browser::BrowserHandler()), |