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()), |
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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 RenderFrameHostImpl* host) { | 600 RenderFrameHostImpl* host) { |
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(host->GetRenderWidgetHost()); | 604 input_handler_->SetRenderWidgetHost(host->GetRenderWidgetHost()); |
602 inspector_handler_->SetRenderFrameHost(host); | 605 inspector_handler_->SetRenderFrameHost(host); |
603 network_handler_->SetRenderFrameHost(host); | 606 network_handler_->SetRenderFrameHost(host); |
604 if (page_handler_) | 607 if (page_handler_) |
605 page_handler_->SetRenderFrameHost(host); | 608 page_handler_->SetRenderFrameHost(host); |
606 service_worker_handler_->SetRenderFrameHost(host); | 609 service_worker_handler_->SetRenderFrameHost(host); |
| 610 if (security_handler_) |
| 611 security_handler_->SetRenderFrameHost(host); |
607 } | 612 } |
608 | 613 |
609 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { | 614 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { |
610 if (pending_) | 615 if (pending_) |
611 DiscardPending(); | 616 DiscardPending(); |
612 UpdateProtocolHandlers(nullptr); | 617 UpdateProtocolHandlers(nullptr); |
613 current_.reset(); | 618 current_.reset(); |
614 WebContentsObserver::Observe(nullptr); | 619 WebContentsObserver::Observe(nullptr); |
615 } | 620 } |
616 | 621 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 RenderFrameHost* host) { | 702 RenderFrameHost* host) { |
698 return (current_ && current_->host() == host) || | 703 return (current_ && current_->host() == host) || |
699 (pending_ && pending_->host() == host); | 704 (pending_ && pending_->host() == host); |
700 } | 705 } |
701 | 706 |
702 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 707 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
703 return current_ && current_->host()->GetParent(); | 708 return current_ && current_->host()->GetParent(); |
704 } | 709 } |
705 | 710 |
706 } // namespace content | 711 } // namespace content |
OLD | NEW |