| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "content/browser/child_process_security_policy_impl.h" | 12 #include "content/browser/child_process_security_policy_impl.h" |
| 13 #include "content/browser/devtools/devtools_frame_trace_recorder.h" | 13 #include "content/browser/devtools/devtools_frame_trace_recorder.h" |
| 14 #include "content/browser/devtools/devtools_protocol_handler.h" | 14 #include "content/browser/devtools/devtools_protocol_handler.h" |
| 15 #include "content/browser/devtools/protocol/dom_handler.h" | 15 #include "content/browser/devtools/protocol/dom_handler.h" |
| 16 #include "content/browser/devtools/protocol/emulation_handler.h" | 16 #include "content/browser/devtools/protocol/emulation_handler.h" |
| 17 #include "content/browser/devtools/protocol/input_handler.h" | 17 #include "content/browser/devtools/protocol/input_handler.h" |
| 18 #include "content/browser/devtools/protocol/inspector_handler.h" | 18 #include "content/browser/devtools/protocol/inspector_handler.h" |
| 19 #include "content/browser/devtools/protocol/io_handler.h" | 19 #include "content/browser/devtools/protocol/io_handler.h" |
| 20 #include "content/browser/devtools/protocol/network_handler.h" | 20 #include "content/browser/devtools/protocol/network_handler.h" |
| 21 #include "content/browser/devtools/protocol/page_handler.h" | 21 #include "content/browser/devtools/protocol/page_handler.h" |
| 22 #include "content/browser/devtools/protocol/security_handler.h" | 22 #include "content/browser/devtools/protocol/security_handler.h" |
| 23 #include "content/browser/devtools/protocol/service_worker_handler.h" | 23 #include "content/browser/devtools/protocol/service_worker_handler.h" |
| 24 #include "content/browser/devtools/protocol/storage_handler.h" |
| 24 #include "content/browser/devtools/protocol/tracing_handler.h" | 25 #include "content/browser/devtools/protocol/tracing_handler.h" |
| 25 #include "content/browser/frame_host/navigation_handle_impl.h" | 26 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 26 #include "content/browser/frame_host/render_frame_host_impl.h" | 27 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 27 #include "content/browser/renderer_host/input/input_router_impl.h" | 28 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 28 #include "content/browser/renderer_host/render_process_host_impl.h" | 29 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 29 #include "content/browser/renderer_host/render_view_host_impl.h" | 30 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 30 #include "content/browser/site_instance_impl.h" | 31 #include "content/browser/site_instance_impl.h" |
| 31 #include "content/browser/web_contents/web_contents_impl.h" | 32 #include "content/browser/web_contents/web_contents_impl.h" |
| 32 #include "content/common/view_messages.h" | 33 #include "content/common/view_messages.h" |
| 33 #include "content/public/browser/browser_context.h" | 34 #include "content/public/browser/browser_context.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 RenderFrameHostImpl* host) | 347 RenderFrameHostImpl* host) |
| 347 : dom_handler_(new devtools::dom::DOMHandler()), | 348 : dom_handler_(new devtools::dom::DOMHandler()), |
| 348 input_handler_(new devtools::input::InputHandler()), | 349 input_handler_(new devtools::input::InputHandler()), |
| 349 inspector_handler_(new devtools::inspector::InspectorHandler()), | 350 inspector_handler_(new devtools::inspector::InspectorHandler()), |
| 350 io_handler_(new devtools::io::IOHandler(GetIOContext())), | 351 io_handler_(new devtools::io::IOHandler(GetIOContext())), |
| 351 network_handler_(new devtools::network::NetworkHandler()), | 352 network_handler_(new devtools::network::NetworkHandler()), |
| 352 page_handler_(nullptr), | 353 page_handler_(nullptr), |
| 353 security_handler_(nullptr), | 354 security_handler_(nullptr), |
| 354 service_worker_handler_( | 355 service_worker_handler_( |
| 355 new devtools::service_worker::ServiceWorkerHandler()), | 356 new devtools::service_worker::ServiceWorkerHandler()), |
| 357 storage_handler_(new devtools::storage::StorageHandler()), |
| 356 tracing_handler_(new devtools::tracing::TracingHandler( | 358 tracing_handler_(new devtools::tracing::TracingHandler( |
| 357 devtools::tracing::TracingHandler::Renderer, | 359 devtools::tracing::TracingHandler::Renderer, |
| 358 host->GetFrameTreeNodeId(), | 360 host->GetFrameTreeNodeId(), |
| 359 GetIOContext())), | 361 GetIOContext())), |
| 360 emulation_handler_(nullptr), | 362 emulation_handler_(nullptr), |
| 361 frame_trace_recorder_(nullptr), | 363 frame_trace_recorder_(nullptr), |
| 362 protocol_handler_(new DevToolsProtocolHandler(this)), | 364 protocol_handler_(new DevToolsProtocolHandler(this)), |
| 363 current_frame_crashed_(false), | 365 current_frame_crashed_(false), |
| 364 pending_handle_(nullptr), | 366 pending_handle_(nullptr), |
| 365 frame_tree_node_(host->frame_tree_node()) { | 367 frame_tree_node_(host->frame_tree_node()) { |
| 366 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | 368 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); |
| 367 dispatcher->SetDOMHandler(dom_handler_.get()); | 369 dispatcher->SetDOMHandler(dom_handler_.get()); |
| 368 dispatcher->SetInputHandler(input_handler_.get()); | 370 dispatcher->SetInputHandler(input_handler_.get()); |
| 369 dispatcher->SetInspectorHandler(inspector_handler_.get()); | 371 dispatcher->SetInspectorHandler(inspector_handler_.get()); |
| 370 dispatcher->SetIOHandler(io_handler_.get()); | 372 dispatcher->SetIOHandler(io_handler_.get()); |
| 371 dispatcher->SetNetworkHandler(network_handler_.get()); | 373 dispatcher->SetNetworkHandler(network_handler_.get()); |
| 372 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); | 374 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); |
| 375 dispatcher->SetStorageHandler(storage_handler_.get()); |
| 373 dispatcher->SetTracingHandler(tracing_handler_.get()); | 376 dispatcher->SetTracingHandler(tracing_handler_.get()); |
| 374 | 377 |
| 375 if (!host->GetParent()) { | 378 if (!host->GetParent()) { |
| 376 security_handler_.reset(new devtools::security::SecurityHandler()); | 379 security_handler_.reset(new devtools::security::SecurityHandler()); |
| 377 page_handler_.reset(new devtools::page::PageHandler()); | 380 page_handler_.reset(new devtools::page::PageHandler()); |
| 378 emulation_handler_.reset( | 381 emulation_handler_.reset( |
| 379 new devtools::emulation::EmulationHandler()); | 382 new devtools::emulation::EmulationHandler()); |
| 380 dispatcher->SetSecurityHandler(security_handler_.get()); | 383 dispatcher->SetSecurityHandler(security_handler_.get()); |
| 381 dispatcher->SetPageHandler(page_handler_.get()); | 384 dispatcher->SetPageHandler(page_handler_.get()); |
| 382 dispatcher->SetEmulationHandler(emulation_handler_.get()); | 385 dispatcher->SetEmulationHandler(emulation_handler_.get()); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 emulation_handler_->SetRenderFrameHost(host); | 768 emulation_handler_->SetRenderFrameHost(host); |
| 766 input_handler_->SetRenderWidgetHost( | 769 input_handler_->SetRenderWidgetHost( |
| 767 host ? host->GetRenderWidgetHost() : nullptr); | 770 host ? host->GetRenderWidgetHost() : nullptr); |
| 768 inspector_handler_->SetRenderFrameHost(host); | 771 inspector_handler_->SetRenderFrameHost(host); |
| 769 network_handler_->SetRenderFrameHost(host); | 772 network_handler_->SetRenderFrameHost(host); |
| 770 if (page_handler_) | 773 if (page_handler_) |
| 771 page_handler_->SetRenderFrameHost(host); | 774 page_handler_->SetRenderFrameHost(host); |
| 772 service_worker_handler_->SetRenderFrameHost(host); | 775 service_worker_handler_->SetRenderFrameHost(host); |
| 773 if (security_handler_) | 776 if (security_handler_) |
| 774 security_handler_->SetRenderFrameHost(host); | 777 security_handler_->SetRenderFrameHost(host); |
| 778 if (storage_handler_) |
| 779 storage_handler_->SetRenderFrameHost(host); |
| 775 } | 780 } |
| 776 | 781 |
| 777 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { | 782 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { |
| 778 if (pending_) | 783 if (pending_) |
| 779 DiscardPending(); | 784 DiscardPending(); |
| 780 UpdateProtocolHandlers(nullptr); | 785 UpdateProtocolHandlers(nullptr); |
| 781 disconnected_ = std::move(current_); | 786 disconnected_ = std::move(current_); |
| 782 disconnected_->Detach(); | 787 disconnected_->Detach(); |
| 783 frame_tree_node_ = nullptr; | 788 frame_tree_node_ = nullptr; |
| 784 in_navigation_protocol_message_buffer_.clear(); | 789 in_navigation_protocol_message_buffer_.clear(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 RenderFrameHost* host) { | 906 RenderFrameHost* host) { |
| 902 return (current_ && current_->host() == host) || | 907 return (current_ && current_->host() == host) || |
| 903 (pending_ && pending_->host() == host); | 908 (pending_ && pending_->host() == host); |
| 904 } | 909 } |
| 905 | 910 |
| 906 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 911 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 907 return current_ && current_->host()->GetParent(); | 912 return current_ && current_->host()->GetParent(); |
| 908 } | 913 } |
| 909 | 914 |
| 910 } // namespace content | 915 } // namespace content |
| OLD | NEW |