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

Unified Diff: content/browser/devtools/render_frame_devtools_agent_host.cc

Issue 2132673002: Adding Navigation Throttles to DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reduce number of delta lines in DevToolsProtocolTest Created 4 years, 5 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/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()),

Powered by Google App Engine
This is Rietveld 408576698