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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
| 11 #include "content/browser/devtools/devtools_frame_trace_recorder.h" | 11 #include "content/browser/devtools/devtools_frame_trace_recorder.h" |
| 12 #include "content/browser/devtools/devtools_protocol_handler.h" | 12 #include "content/browser/devtools/devtools_protocol_handler.h" |
| 13 #include "content/browser/devtools/protocol/dom_handler.h" | 13 #include "content/browser/devtools/protocol/dom_handler.h" |
| 14 #include "content/browser/devtools/protocol/emulation_handler.h" | 14 #include "content/browser/devtools/protocol/emulation_handler.h" |
| 15 #include "content/browser/devtools/protocol/input_handler.h" | 15 #include "content/browser/devtools/protocol/input_handler.h" |
| 16 #include "content/browser/devtools/protocol/inspector_handler.h" | 16 #include "content/browser/devtools/protocol/inspector_handler.h" |
| 17 #include "content/browser/devtools/protocol/network_handler.h" | 17 #include "content/browser/devtools/protocol/network_handler.h" |
| 18 #include "content/browser/devtools/protocol/page_handler.h" | 18 #include "content/browser/devtools/protocol/page_handler.h" |
| 19 #include "content/browser/devtools/protocol/power_handler.h" | 19 #include "content/browser/devtools/protocol/power_handler.h" |
| 20 #include "content/browser/devtools/protocol/security_handler.h" | |
| 20 #include "content/browser/devtools/protocol/service_worker_handler.h" | 21 #include "content/browser/devtools/protocol/service_worker_handler.h" |
| 21 #include "content/browser/devtools/protocol/tracing_handler.h" | 22 #include "content/browser/devtools/protocol/tracing_handler.h" |
| 22 #include "content/browser/frame_host/render_frame_host_impl.h" | 23 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 23 #include "content/browser/renderer_host/render_process_host_impl.h" | 24 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 24 #include "content/browser/renderer_host/render_view_host_impl.h" | 25 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 25 #include "content/browser/site_instance_impl.h" | 26 #include "content/browser/site_instance_impl.h" |
| 26 #include "content/browser/web_contents/web_contents_impl.h" | 27 #include "content/browser/web_contents/web_contents_impl.h" |
| 27 #include "content/common/view_messages.h" | 28 #include "content/common/view_messages.h" |
| 28 #include "content/public/browser/browser_context.h" | 29 #include "content/public/browser/browser_context.h" |
| 29 #include "content/public/browser/content_browser_client.h" | 30 #include "content/public/browser/content_browser_client.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 } | 289 } |
| 289 | 290 |
| 290 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( | 291 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( |
| 291 RenderFrameHostImpl* host) | 292 RenderFrameHostImpl* host) |
| 292 : dom_handler_(new devtools::dom::DOMHandler()), | 293 : dom_handler_(new devtools::dom::DOMHandler()), |
| 293 input_handler_(new devtools::input::InputHandler()), | 294 input_handler_(new devtools::input::InputHandler()), |
| 294 inspector_handler_(new devtools::inspector::InspectorHandler()), | 295 inspector_handler_(new devtools::inspector::InspectorHandler()), |
| 295 network_handler_(new devtools::network::NetworkHandler()), | 296 network_handler_(new devtools::network::NetworkHandler()), |
| 296 page_handler_(nullptr), | 297 page_handler_(nullptr), |
| 297 power_handler_(new devtools::power::PowerHandler()), | 298 power_handler_(new devtools::power::PowerHandler()), |
| 299 security_handler_(new devtools::security::SecurityHandler()), | |
|
pfeldman
2015/06/12 17:46:02
Initialize it on line 325/326 for top level frames
lgarron
2015/06/12 18:38:10
Ooh, cool. Done. :-)
| |
| 298 service_worker_handler_( | 300 service_worker_handler_( |
| 299 new devtools::service_worker::ServiceWorkerHandler()), | 301 new devtools::service_worker::ServiceWorkerHandler()), |
| 300 tracing_handler_(new devtools::tracing::TracingHandler( | 302 tracing_handler_(new devtools::tracing::TracingHandler( |
| 301 devtools::tracing::TracingHandler::Renderer)), | 303 devtools::tracing::TracingHandler::Renderer)), |
| 302 emulation_handler_(nullptr), | 304 emulation_handler_(nullptr), |
| 303 frame_trace_recorder_(nullptr), | 305 frame_trace_recorder_(nullptr), |
| 304 protocol_handler_(new DevToolsProtocolHandler( | 306 protocol_handler_(new DevToolsProtocolHandler( |
| 305 this, | 307 this, |
| 306 base::Bind(&RenderFrameDevToolsAgentHost::SendMessageToClient, | 308 base::Bind(&RenderFrameDevToolsAgentHost::SendMessageToClient, |
| 307 base::Unretained(this)))) { | 309 base::Unretained(this)))) { |
| 308 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | 310 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); |
| 309 dispatcher->SetDOMHandler(dom_handler_.get()); | 311 dispatcher->SetDOMHandler(dom_handler_.get()); |
| 310 dispatcher->SetInputHandler(input_handler_.get()); | 312 dispatcher->SetInputHandler(input_handler_.get()); |
| 311 dispatcher->SetInspectorHandler(inspector_handler_.get()); | 313 dispatcher->SetInspectorHandler(inspector_handler_.get()); |
| 312 dispatcher->SetNetworkHandler(network_handler_.get()); | 314 dispatcher->SetNetworkHandler(network_handler_.get()); |
| 313 dispatcher->SetPowerHandler(power_handler_.get()); | 315 dispatcher->SetPowerHandler(power_handler_.get()); |
| 316 dispatcher->SetSecurityHandler(security_handler_.get()); | |
| 314 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); | 317 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); |
| 315 dispatcher->SetTracingHandler(tracing_handler_.get()); | 318 dispatcher->SetTracingHandler(tracing_handler_.get()); |
| 316 | 319 |
| 317 if (!host->GetParent()) { | 320 if (!host->GetParent()) { |
| 318 page_handler_.reset(new devtools::page::PageHandler()); | 321 page_handler_.reset(new devtools::page::PageHandler()); |
| 319 emulation_handler_.reset( | 322 emulation_handler_.reset( |
| 320 new devtools::emulation::EmulationHandler(page_handler_.get())); | 323 new devtools::emulation::EmulationHandler(page_handler_.get())); |
| 321 dispatcher->SetPageHandler(page_handler_.get()); | 324 dispatcher->SetPageHandler(page_handler_.get()); |
| 322 dispatcher->SetEmulationHandler(emulation_handler_.get()); | 325 dispatcher->SetEmulationHandler(emulation_handler_.get()); |
| 323 } | 326 } |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 dom_handler_->SetRenderFrameHost(host); | 601 dom_handler_->SetRenderFrameHost(host); |
| 599 if (emulation_handler_) | 602 if (emulation_handler_) |
| 600 emulation_handler_->SetRenderFrameHost(host); | 603 emulation_handler_->SetRenderFrameHost(host); |
| 601 input_handler_->SetRenderWidgetHost( | 604 input_handler_->SetRenderWidgetHost( |
| 602 host ? host->GetRenderWidgetHost() : nullptr); | 605 host ? host->GetRenderWidgetHost() : nullptr); |
| 603 inspector_handler_->SetRenderFrameHost(host); | 606 inspector_handler_->SetRenderFrameHost(host); |
| 604 network_handler_->SetRenderFrameHost(host); | 607 network_handler_->SetRenderFrameHost(host); |
| 605 if (page_handler_) | 608 if (page_handler_) |
| 606 page_handler_->SetRenderFrameHost(host); | 609 page_handler_->SetRenderFrameHost(host); |
| 607 service_worker_handler_->SetRenderFrameHost(host); | 610 service_worker_handler_->SetRenderFrameHost(host); |
| 611 if (security_handler_) | |
| 612 security_handler_->SetRenderFrameHost(host); | |
| 608 } | 613 } |
| 609 | 614 |
| 610 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { | 615 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { |
| 611 if (pending_) | 616 if (pending_) |
| 612 DiscardPending(); | 617 DiscardPending(); |
| 613 UpdateProtocolHandlers(nullptr); | 618 UpdateProtocolHandlers(nullptr); |
| 614 current_.reset(); | 619 current_.reset(); |
| 615 WebContentsObserver::Observe(nullptr); | 620 WebContentsObserver::Observe(nullptr); |
| 616 } | 621 } |
| 617 | 622 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 RenderFrameHost* host) { | 703 RenderFrameHost* host) { |
| 699 return (current_ && current_->host() == host) || | 704 return (current_ && current_->host() == host) || |
| 700 (pending_ && pending_->host() == host); | 705 (pending_ && pending_->host() == host); |
| 701 } | 706 } |
| 702 | 707 |
| 703 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 708 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 704 return current_ && current_->host()->GetParent(); | 709 return current_ && current_->host()->GetParent(); |
| 705 } | 710 } |
| 706 | 711 |
| 707 } // namespace content | 712 } // namespace content |
| OLD | NEW |