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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 agent_host->DiscardPending(); | 287 agent_host->DiscardPending(); |
| 287 } | 288 } |
| 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), | |
|
estark
2015/06/09 05:18:55
Why did this get deleted? Mistake?
lgarron
2015/06/09 18:16:57
This was deleted in an intervening ToT commit, whi
| |
| 297 power_handler_(new devtools::power::PowerHandler()), | 297 power_handler_(new devtools::power::PowerHandler()), |
| 298 security_handler_(new devtools::security::SecurityHandler()), | |
| 298 service_worker_handler_( | 299 service_worker_handler_( |
| 299 new devtools::service_worker::ServiceWorkerHandler()), | 300 new devtools::service_worker::ServiceWorkerHandler()), |
| 300 tracing_handler_(new devtools::tracing::TracingHandler( | 301 tracing_handler_(new devtools::tracing::TracingHandler( |
| 301 devtools::tracing::TracingHandler::Renderer)), | 302 devtools::tracing::TracingHandler::Renderer)), |
| 302 emulation_handler_(nullptr), | 303 emulation_handler_(nullptr), |
| 303 frame_trace_recorder_(nullptr), | 304 frame_trace_recorder_(nullptr), |
| 304 protocol_handler_(new DevToolsProtocolHandler( | 305 protocol_handler_(new DevToolsProtocolHandler( |
| 305 this, | 306 this, |
| 306 base::Bind(&RenderFrameDevToolsAgentHost::SendMessageToClient, | 307 base::Bind(&RenderFrameDevToolsAgentHost::SendMessageToClient, |
| 307 base::Unretained(this)))) { | 308 base::Unretained(this)))) { |
| 308 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | 309 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); |
| 309 dispatcher->SetDOMHandler(dom_handler_.get()); | 310 dispatcher->SetDOMHandler(dom_handler_.get()); |
| 310 dispatcher->SetInputHandler(input_handler_.get()); | 311 dispatcher->SetInputHandler(input_handler_.get()); |
| 311 dispatcher->SetInspectorHandler(inspector_handler_.get()); | 312 dispatcher->SetInspectorHandler(inspector_handler_.get()); |
| 312 dispatcher->SetNetworkHandler(network_handler_.get()); | 313 dispatcher->SetNetworkHandler(network_handler_.get()); |
| 313 dispatcher->SetPowerHandler(power_handler_.get()); | 314 dispatcher->SetPowerHandler(power_handler_.get()); |
| 315 dispatcher->SetSecurityHandler(security_handler_.get()); | |
| 314 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); | 316 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); |
| 315 dispatcher->SetTracingHandler(tracing_handler_.get()); | 317 dispatcher->SetTracingHandler(tracing_handler_.get()); |
| 316 | 318 |
| 317 if (!host->GetParent()) { | 319 if (!host->GetParent()) { |
| 318 page_handler_.reset(new devtools::page::PageHandler()); | 320 page_handler_.reset(new devtools::page::PageHandler()); |
| 319 emulation_handler_.reset( | 321 emulation_handler_.reset( |
| 320 new devtools::emulation::EmulationHandler(page_handler_.get())); | 322 new devtools::emulation::EmulationHandler(page_handler_.get())); |
| 321 dispatcher->SetPageHandler(page_handler_.get()); | 323 dispatcher->SetPageHandler(page_handler_.get()); |
| 322 dispatcher->SetEmulationHandler(emulation_handler_.get()); | 324 dispatcher->SetEmulationHandler(emulation_handler_.get()); |
| 323 } | 325 } |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 597 RenderFrameHostImpl* host) { | 599 RenderFrameHostImpl* host) { |
| 598 dom_handler_->SetRenderFrameHost(host); | 600 dom_handler_->SetRenderFrameHost(host); |
| 599 if (emulation_handler_) | 601 if (emulation_handler_) |
| 600 emulation_handler_->SetRenderFrameHost(host); | 602 emulation_handler_->SetRenderFrameHost(host); |
| 601 input_handler_->SetRenderWidgetHost(host->GetRenderWidgetHost()); | 603 input_handler_->SetRenderWidgetHost(host->GetRenderWidgetHost()); |
| 602 inspector_handler_->SetRenderFrameHost(host); | 604 inspector_handler_->SetRenderFrameHost(host); |
| 603 network_handler_->SetRenderFrameHost(host); | 605 network_handler_->SetRenderFrameHost(host); |
| 604 if (page_handler_) | 606 if (page_handler_) |
| 605 page_handler_->SetRenderFrameHost(host); | 607 page_handler_->SetRenderFrameHost(host); |
| 606 service_worker_handler_->SetRenderFrameHost(host); | 608 service_worker_handler_->SetRenderFrameHost(host); |
| 609 if (security_handler_) | |
| 610 security_handler_->SetRenderFrameHost(host); | |
| 607 } | 611 } |
| 608 | 612 |
| 609 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { | 613 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { |
| 610 if (pending_) | 614 if (pending_) |
| 611 DiscardPending(); | 615 DiscardPending(); |
| 612 UpdateProtocolHandlers(nullptr); | 616 UpdateProtocolHandlers(nullptr); |
| 613 current_.reset(); | 617 current_.reset(); |
| 614 WebContentsObserver::Observe(nullptr); | 618 WebContentsObserver::Observe(nullptr); |
| 615 } | 619 } |
| 616 | 620 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 RenderFrameHost* host) { | 701 RenderFrameHost* host) { |
| 698 return (current_ && current_->host() == host) || | 702 return (current_ && current_->host() == host) || |
| 699 (pending_ && pending_->host() == host); | 703 (pending_ && pending_->host() == host); |
| 700 } | 704 } |
| 701 | 705 |
| 702 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 706 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 703 return current_ && current_->host()->GetParent(); | 707 return current_ && current_->host()->GetParent(); |
| 704 } | 708 } |
| 705 | 709 |
| 706 } // namespace content | 710 } // namespace content |
| OLD | NEW |