| 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/guid.h" | 10 #include "base/guid.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 WebContents* web_contents) { | 387 WebContents* web_contents) { |
| 388 if (ShouldForceCreation()) { | 388 if (ShouldForceCreation()) { |
| 389 // Force agent host. | 389 // Force agent host. |
| 390 DevToolsAgentHost::GetOrCreateFor(web_contents); | 390 DevToolsAgentHost::GetOrCreateFor(web_contents); |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 | 393 |
| 394 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( | 394 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( |
| 395 RenderFrameHostImpl* host) | 395 RenderFrameHostImpl* host) |
| 396 : DevToolsAgentHostImpl(base::GenerateGUID()), | 396 : DevToolsAgentHostImpl(base::GenerateGUID()), |
| 397 input_handler_(new devtools::input::InputHandler()), | |
| 398 frame_trace_recorder_(nullptr), | 397 frame_trace_recorder_(nullptr), |
| 399 protocol_handler_(new DevToolsProtocolHandler(this)), | 398 protocol_handler_(new DevToolsProtocolHandler(this)), |
| 400 handlers_frame_host_(nullptr), | 399 handlers_frame_host_(nullptr), |
| 401 current_frame_crashed_(false), | 400 current_frame_crashed_(false), |
| 402 pending_handle_(nullptr), | 401 pending_handle_(nullptr), |
| 403 frame_tree_node_(host->frame_tree_node()) { | 402 frame_tree_node_(host->frame_tree_node()) { |
| 404 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | |
| 405 dispatcher->SetInputHandler(input_handler_.get()); | |
| 406 | |
| 407 SetPending(host); | 403 SetPending(host); |
| 408 CommitPending(); | 404 CommitPending(); |
| 409 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); | 405 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); |
| 410 | 406 |
| 411 if (web_contents() && web_contents()->GetCrashedStatus() != | 407 if (web_contents() && web_contents()->GetCrashedStatus() != |
| 412 base::TERMINATION_STATUS_STILL_RUNNING) { | 408 base::TERMINATION_STATUS_STILL_RUNNING) { |
| 413 current_frame_crashed_ = true; | 409 current_frame_crashed_ = true; |
| 414 } | 410 } |
| 415 | 411 |
| 416 g_instances.Get().push_back(this); | 412 g_instances.Get().push_back(this); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 if (!frame_tree_node_->parent()) { | 467 if (!frame_tree_node_->parent()) { |
| 472 emulation_handler_.reset(new protocol::EmulationHandler()); | 468 emulation_handler_.reset(new protocol::EmulationHandler()); |
| 473 emulation_handler_->Wire(session()->dispatcher()); | 469 emulation_handler_->Wire(session()->dispatcher()); |
| 474 emulation_handler_->SetRenderFrameHost(handlers_frame_host_); | 470 emulation_handler_->SetRenderFrameHost(handlers_frame_host_); |
| 475 } | 471 } |
| 476 | 472 |
| 477 dom_handler_.reset(new protocol::DOMHandler()); | 473 dom_handler_.reset(new protocol::DOMHandler()); |
| 478 dom_handler_->Wire(session()->dispatcher()); | 474 dom_handler_->Wire(session()->dispatcher()); |
| 479 dom_handler_->SetRenderFrameHost(handlers_frame_host_); | 475 dom_handler_->SetRenderFrameHost(handlers_frame_host_); |
| 480 | 476 |
| 477 input_handler_.reset(new protocol::InputHandler()); |
| 478 input_handler_->Wire(session()->dispatcher()); |
| 479 input_handler_->SetRenderFrameHost(handlers_frame_host_); |
| 480 |
| 481 inspector_handler_.reset(new protocol::InspectorHandler()); | 481 inspector_handler_.reset(new protocol::InspectorHandler()); |
| 482 inspector_handler_->Wire(session()->dispatcher()); | 482 inspector_handler_->Wire(session()->dispatcher()); |
| 483 inspector_handler_->SetRenderFrameHost(handlers_frame_host_); | 483 inspector_handler_->SetRenderFrameHost(handlers_frame_host_); |
| 484 | 484 |
| 485 io_handler_.reset(new protocol::IOHandler(GetIOContext())); | 485 io_handler_.reset(new protocol::IOHandler(GetIOContext())); |
| 486 io_handler_->Wire(session()->dispatcher()); | 486 io_handler_->Wire(session()->dispatcher()); |
| 487 | 487 |
| 488 network_handler_.reset(new protocol::NetworkHandler()); | 488 network_handler_.reset(new protocol::NetworkHandler()); |
| 489 network_handler_->Wire(session()->dispatcher()); | 489 network_handler_->Wire(session()->dispatcher()); |
| 490 network_handler_->SetRenderFrameHost(handlers_frame_host_); | 490 network_handler_->SetRenderFrameHost(handlers_frame_host_); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 OnClientAttached(); | 529 OnClientAttached(); |
| 530 } | 530 } |
| 531 | 531 |
| 532 void RenderFrameDevToolsAgentHost::Detach() { | 532 void RenderFrameDevToolsAgentHost::Detach() { |
| 533 dom_handler_->Disable(); | 533 dom_handler_->Disable(); |
| 534 dom_handler_.reset(); | 534 dom_handler_.reset(); |
| 535 if (emulation_handler_) { | 535 if (emulation_handler_) { |
| 536 emulation_handler_->Disable(); | 536 emulation_handler_->Disable(); |
| 537 emulation_handler_.reset(); | 537 emulation_handler_.reset(); |
| 538 } | 538 } |
| 539 input_handler_->Disable(); |
| 540 input_handler_.reset(); |
| 539 inspector_handler_->Disable(); | 541 inspector_handler_->Disable(); |
| 540 inspector_handler_.reset(); | 542 inspector_handler_.reset(); |
| 541 io_handler_->Disable(); | 543 io_handler_->Disable(); |
| 542 io_handler_.reset(); | 544 io_handler_.reset(); |
| 543 network_handler_->Disable(); | 545 network_handler_->Disable(); |
| 544 network_handler_.reset(); | 546 network_handler_.reset(); |
| 545 if (page_handler_) { | 547 if (page_handler_) { |
| 546 page_handler_->Disable(); | 548 page_handler_->Disable(); |
| 547 page_handler_.reset(); | 549 page_handler_.reset(); |
| 548 } | 550 } |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 // Check that we don't have stale host object here by accessing some random | 958 // Check that we don't have stale host object here by accessing some random |
| 957 // properties inside. | 959 // properties inside. |
| 958 if (handlers_frame_host_ && handlers_frame_host_->GetRenderWidgetHost()) | 960 if (handlers_frame_host_ && handlers_frame_host_->GetRenderWidgetHost()) |
| 959 handlers_frame_host_->GetRenderWidgetHost()->GetRoutingID(); | 961 handlers_frame_host_->GetRenderWidgetHost()->GetRoutingID(); |
| 960 #endif | 962 #endif |
| 961 handlers_frame_host_ = host; | 963 handlers_frame_host_ = host; |
| 962 if (dom_handler_) | 964 if (dom_handler_) |
| 963 dom_handler_->SetRenderFrameHost(host); | 965 dom_handler_->SetRenderFrameHost(host); |
| 964 if (emulation_handler_) | 966 if (emulation_handler_) |
| 965 emulation_handler_->SetRenderFrameHost(host); | 967 emulation_handler_->SetRenderFrameHost(host); |
| 966 input_handler_->SetRenderWidgetHost( | 968 if (input_handler_) |
| 967 host ? host->GetRenderWidgetHost() : nullptr); | 969 input_handler_->SetRenderFrameHost(host); |
| 968 if (inspector_handler_) | 970 if (inspector_handler_) |
| 969 inspector_handler_->SetRenderFrameHost(host); | 971 inspector_handler_->SetRenderFrameHost(host); |
| 970 if (network_handler_) | 972 if (network_handler_) |
| 971 network_handler_->SetRenderFrameHost(host); | 973 network_handler_->SetRenderFrameHost(host); |
| 972 if (page_handler_) | 974 if (page_handler_) |
| 973 page_handler_->SetRenderFrameHost(host); | 975 page_handler_->SetRenderFrameHost(host); |
| 974 if (service_worker_handler_) | 976 if (service_worker_handler_) |
| 975 service_worker_handler_->SetRenderFrameHost(host); | 977 service_worker_handler_->SetRenderFrameHost(host); |
| 976 if (security_handler_) | 978 if (security_handler_) |
| 977 security_handler_->SetRenderFrameHost(host); | 979 security_handler_->SetRenderFrameHost(host); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 RenderFrameHost* host) { | 1194 RenderFrameHost* host) { |
| 1193 return (current_ && current_->host() == host) || | 1195 return (current_ && current_->host() == host) || |
| 1194 (pending_ && pending_->host() == host); | 1196 (pending_ && pending_->host() == host); |
| 1195 } | 1197 } |
| 1196 | 1198 |
| 1197 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1199 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 1198 return current_ && current_->host()->GetParent(); | 1200 return current_ && current_->host()->GetParent(); |
| 1199 } | 1201 } |
| 1200 | 1202 |
| 1201 } // namespace content | 1203 } // namespace content |
| OLD | NEW |