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

Side by Side 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: Add missing files 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "content/browser/child_process_security_policy_impl.h" 13 #include "content/browser/child_process_security_policy_impl.h"
14 #include "content/browser/devtools/devtools_frame_trace_recorder.h" 14 #include "content/browser/devtools/devtools_frame_trace_recorder.h"
15 #include "content/browser/devtools/devtools_protocol_handler.h" 15 #include "content/browser/devtools/devtools_protocol_handler.h"
16 #include "content/browser/devtools/page_navigation_throttle.h"
16 #include "content/browser/devtools/protocol/browser_handler.h" 17 #include "content/browser/devtools/protocol/browser_handler.h"
17 #include "content/browser/devtools/protocol/dom_handler.h" 18 #include "content/browser/devtools/protocol/dom_handler.h"
18 #include "content/browser/devtools/protocol/emulation_handler.h" 19 #include "content/browser/devtools/protocol/emulation_handler.h"
19 #include "content/browser/devtools/protocol/input_handler.h" 20 #include "content/browser/devtools/protocol/input_handler.h"
20 #include "content/browser/devtools/protocol/inspector_handler.h" 21 #include "content/browser/devtools/protocol/inspector_handler.h"
21 #include "content/browser/devtools/protocol/io_handler.h" 22 #include "content/browser/devtools/protocol/io_handler.h"
22 #include "content/browser/devtools/protocol/network_handler.h" 23 #include "content/browser/devtools/protocol/network_handler.h"
23 #include "content/browser/devtools/protocol/page_handler.h" 24 #include "content/browser/devtools/protocol/page_handler.h"
24 #include "content/browser/devtools/protocol/security_handler.h" 25 #include "content/browser/devtools/protocol/security_handler.h"
25 #include "content/browser/devtools/protocol/service_worker_handler.h" 26 #include "content/browser/devtools/protocol/service_worker_handler.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // static 339 // static
339 void RenderFrameDevToolsAgentHost::OnBeforeNavigation( 340 void RenderFrameDevToolsAgentHost::OnBeforeNavigation(
340 NavigationHandle* navigation_handle) { 341 NavigationHandle* navigation_handle) {
341 FrameTreeNode* frame_tree_node = 342 FrameTreeNode* frame_tree_node =
342 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); 343 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node();
343 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); 344 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node);
344 if (agent_host) 345 if (agent_host)
345 agent_host->AboutToNavigate(navigation_handle); 346 agent_host->AboutToNavigate(navigation_handle);
346 } 347 }
347 348
349 // static
350 std::unique_ptr<NavigationThrottle>
351 RenderFrameDevToolsAgentHost::GetThrottleForNavigation(
352 NavigationHandle* navigation_handle) {
353 FrameTreeNode* frame_tree_node =
354 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node();
355 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node);
dgozman 2016/07/07 19:25:58 Do you want to throttle navigations in subframes a
alex clarke (OOO till 29th) 2016/07/08 10:37:58 Yes we do :) Is it better to go via the WebConten
dgozman 2016/07/08 19:19:59 OOPIFs step in here: we should go up the tree to t
alex clarke (OOO till 29th) 2016/07/08 20:55:37 I'm not up to speed with these trees but it looks
356 if (agent_host) {
357 return agent_host->page_handler_->GetThrottleForNavigation(
358 navigation_handle);
359 }
360 return nullptr;
361 }
362
348 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( 363 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost(
349 RenderFrameHostImpl* host) 364 RenderFrameHostImpl* host)
350 : browser_handler_(new devtools::browser::BrowserHandler()), 365 : browser_handler_(new devtools::browser::BrowserHandler()),
351 dom_handler_(new devtools::dom::DOMHandler()), 366 dom_handler_(new devtools::dom::DOMHandler()),
352 input_handler_(new devtools::input::InputHandler()), 367 input_handler_(new devtools::input::InputHandler()),
353 inspector_handler_(new devtools::inspector::InspectorHandler()), 368 inspector_handler_(new devtools::inspector::InspectorHandler()),
354 io_handler_(new devtools::io::IOHandler(GetIOContext())), 369 io_handler_(new devtools::io::IOHandler(GetIOContext())),
355 network_handler_(new devtools::network::NetworkHandler()), 370 network_handler_(new devtools::network::NetworkHandler()),
356 page_handler_(nullptr), 371 page_handler_(nullptr),
357 security_handler_(nullptr), 372 security_handler_(nullptr),
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 RenderFrameHost* host) { 937 RenderFrameHost* host) {
923 return (current_ && current_->host() == host) || 938 return (current_ && current_->host() == host) ||
924 (pending_ && pending_->host() == host); 939 (pending_ && pending_->host() == host);
925 } 940 }
926 941
927 bool RenderFrameDevToolsAgentHost::IsChildFrame() { 942 bool RenderFrameDevToolsAgentHost::IsChildFrame() {
928 return current_ && current_->host()->GetParent(); 943 return current_ && current_->host()->GetParent();
929 } 944 }
930 945
931 } // namespace content 946 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698