Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 RenderFrameDevToolsAgentHost* agent_host = | |
| 354 FindAgentHost(navigation_handle->GetWebContents()); | |
| 355 if (agent_host) { | |
| 356 return agent_host->page_handler_->GetThrottleForNavigation( | |
|
dgozman
2016/07/08 19:20:00
Not that page_handler_ may be null for subframes D
alex clarke (OOO till 29th)
2016/07/08 20:55:37
Done.
| |
| 357 navigation_handle); | |
| 358 } | |
| 359 return nullptr; | |
| 360 } | |
| 361 | |
| 348 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( | 362 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( |
| 349 RenderFrameHostImpl* host) | 363 RenderFrameHostImpl* host) |
| 350 : browser_handler_(new devtools::browser::BrowserHandler()), | 364 : browser_handler_(new devtools::browser::BrowserHandler()), |
| 351 dom_handler_(new devtools::dom::DOMHandler()), | 365 dom_handler_(new devtools::dom::DOMHandler()), |
| 352 input_handler_(new devtools::input::InputHandler()), | 366 input_handler_(new devtools::input::InputHandler()), |
| 353 inspector_handler_(new devtools::inspector::InspectorHandler()), | 367 inspector_handler_(new devtools::inspector::InspectorHandler()), |
| 354 io_handler_(new devtools::io::IOHandler(GetIOContext())), | 368 io_handler_(new devtools::io::IOHandler(GetIOContext())), |
| 355 network_handler_(new devtools::network::NetworkHandler()), | 369 network_handler_(new devtools::network::NetworkHandler()), |
| 356 page_handler_(nullptr), | 370 page_handler_(nullptr), |
| 357 security_handler_(nullptr), | 371 security_handler_(nullptr), |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 RenderFrameHost* host) { | 936 RenderFrameHost* host) { |
| 923 return (current_ && current_->host() == host) || | 937 return (current_ && current_->host() == host) || |
| 924 (pending_ && pending_->host() == host); | 938 (pending_ && pending_->host() == host); |
| 925 } | 939 } |
| 926 | 940 |
| 927 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 941 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 928 return current_ && current_->host()->GetParent(); | 942 return current_ && current_->host()->GetParent(); |
| 929 } | 943 } |
| 930 | 944 |
| 931 } // namespace content | 945 } // namespace content |
| OLD | NEW |