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

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: Moved RegisterNavigationThrottles 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..33f43b6ac6a7278f5c75836571a83ed653b46d4b 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,23 @@ 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();
+ while (frame_tree_node && frame_tree_node->parent()) {
+ frame_tree_node = frame_tree_node->parent();
nasko 2016/07/12 18:03:11 Is this code compatible with out-of-process iframe
alex clarke (OOO till 29th) 2016/07/12 20:36:14 I'm not sure. I'm not up to speed with OOPIF.
nasko 2016/07/12 23:08:21 I'd suggest discussing more with dgozman@, as I'm
dgozman 2016/07/12 23:56:15 I think this API only makes sense for the page as
alex clarke (OOO till 29th) 2016/07/13 09:18:44 I agree.
nasko 2016/07/13 14:55:55 Is this feature supposed to allow you to control n
alex clarke (OOO till 29th) 2016/07/13 16:14:23 In both.
nasko 2016/07/13 16:35:52 I'm not sure what the design goal of this CL is, s
+ }
+ RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node);
+ 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()),

Powered by Google App Engine
This is Rietveld 408576698