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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()), | 397 input_handler_(new devtools::input::InputHandler()), |
| 398 security_handler_(nullptr), |
398 service_worker_handler_( | 399 service_worker_handler_( |
399 new devtools::service_worker::ServiceWorkerHandler()), | 400 new devtools::service_worker::ServiceWorkerHandler()), |
400 storage_handler_(new devtools::storage::StorageHandler()), | 401 storage_handler_(new devtools::storage::StorageHandler()), |
401 target_handler_(new devtools::target::TargetHandler()), | 402 target_handler_(new devtools::target::TargetHandler()), |
402 frame_trace_recorder_(nullptr), | 403 frame_trace_recorder_(nullptr), |
403 protocol_handler_(new DevToolsProtocolHandler(this)), | 404 protocol_handler_(new DevToolsProtocolHandler(this)), |
404 handlers_frame_host_(nullptr), | 405 handlers_frame_host_(nullptr), |
405 current_frame_crashed_(false), | 406 current_frame_crashed_(false), |
406 pending_handle_(nullptr), | 407 pending_handle_(nullptr), |
407 frame_tree_node_(host->frame_tree_node()) { | 408 frame_tree_node_(host->frame_tree_node()) { |
408 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); | 409 DevToolsProtocolDispatcher* dispatcher = protocol_handler_->dispatcher(); |
409 dispatcher->SetInputHandler(input_handler_.get()); | 410 dispatcher->SetInputHandler(input_handler_.get()); |
410 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); | 411 dispatcher->SetServiceWorkerHandler(service_worker_handler_.get()); |
411 dispatcher->SetStorageHandler(storage_handler_.get()); | 412 dispatcher->SetStorageHandler(storage_handler_.get()); |
412 dispatcher->SetTargetHandler(target_handler_.get()); | 413 dispatcher->SetTargetHandler(target_handler_.get()); |
413 | 414 |
| 415 if (!host->GetParent()) { |
| 416 security_handler_.reset(new devtools::security::SecurityHandler()); |
| 417 dispatcher->SetSecurityHandler(security_handler_.get()); |
| 418 } |
| 419 |
414 SetPending(host); | 420 SetPending(host); |
415 CommitPending(); | 421 CommitPending(); |
416 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); | 422 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); |
417 | 423 |
418 if (web_contents() && web_contents()->GetCrashedStatus() != | 424 if (web_contents() && web_contents()->GetCrashedStatus() != |
419 base::TERMINATION_STATUS_STILL_RUNNING) { | 425 base::TERMINATION_STATUS_STILL_RUNNING) { |
420 current_frame_crashed_ = true; | 426 current_frame_crashed_ = true; |
421 } | 427 } |
422 | 428 |
423 g_instances.Get().push_back(this); | 429 g_instances.Get().push_back(this); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 504 |
499 if (!frame_tree_node_->parent()) { | 505 if (!frame_tree_node_->parent()) { |
500 page_handler_.reset(new protocol::PageHandler()); | 506 page_handler_.reset(new protocol::PageHandler()); |
501 page_handler_->Wire(session()->dispatcher()); | 507 page_handler_->Wire(session()->dispatcher()); |
502 page_handler_->SetRenderFrameHost(handlers_frame_host_); | 508 page_handler_->SetRenderFrameHost(handlers_frame_host_); |
503 } | 509 } |
504 | 510 |
505 schema_handler_.reset(new protocol::SchemaHandler()); | 511 schema_handler_.reset(new protocol::SchemaHandler()); |
506 schema_handler_->Wire(session()->dispatcher()); | 512 schema_handler_->Wire(session()->dispatcher()); |
507 | 513 |
508 if (!frame_tree_node_->parent()) { | |
509 security_handler_.reset(new protocol::SecurityHandler()); | |
510 security_handler_->Wire(session()->dispatcher()); | |
511 security_handler_->SetRenderFrameHost(handlers_frame_host_); | |
512 } | |
513 | |
514 tracing_handler_.reset(new protocol::TracingHandler( | 514 tracing_handler_.reset(new protocol::TracingHandler( |
515 protocol::TracingHandler::Renderer, | 515 protocol::TracingHandler::Renderer, |
516 frame_tree_node_->frame_tree_node_id(), | 516 frame_tree_node_->frame_tree_node_id(), |
517 GetIOContext())); | 517 GetIOContext())); |
518 tracing_handler_->Wire(session()->dispatcher()); | 518 tracing_handler_->Wire(session()->dispatcher()); |
519 | 519 |
520 if (current_) | 520 if (current_) |
521 current_->Attach(); | 521 current_->Attach(); |
522 if (pending_) | 522 if (pending_) |
523 pending_->Attach(); | 523 pending_->Attach(); |
(...skipping 12 matching lines...) Expand all Loading... |
536 io_handler_->Disable(); | 536 io_handler_->Disable(); |
537 io_handler_.reset(); | 537 io_handler_.reset(); |
538 network_handler_->Disable(); | 538 network_handler_->Disable(); |
539 network_handler_.reset(); | 539 network_handler_.reset(); |
540 if (page_handler_) { | 540 if (page_handler_) { |
541 page_handler_->Disable(); | 541 page_handler_->Disable(); |
542 page_handler_.reset(); | 542 page_handler_.reset(); |
543 } | 543 } |
544 schema_handler_->Disable(); | 544 schema_handler_->Disable(); |
545 schema_handler_.reset(); | 545 schema_handler_.reset(); |
546 if (security_handler_) { | |
547 security_handler_->Disable(); | |
548 security_handler_.reset(); | |
549 } | |
550 tracing_handler_->Disable(); | 546 tracing_handler_->Disable(); |
551 tracing_handler_.reset(); | 547 tracing_handler_.reset(); |
552 | 548 |
553 if (current_) | 549 if (current_) |
554 current_->Detach(); | 550 current_->Detach(); |
555 if (pending_) | 551 if (pending_) |
556 pending_->Detach(); | 552 pending_->Detach(); |
557 OnClientDetached(); | 553 OnClientDetached(); |
558 } | 554 } |
559 | 555 |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 RenderFrameHost* host) { | 1175 RenderFrameHost* host) { |
1180 return (current_ && current_->host() == host) || | 1176 return (current_ && current_->host() == host) || |
1181 (pending_ && pending_->host() == host); | 1177 (pending_ && pending_->host() == host); |
1182 } | 1178 } |
1183 | 1179 |
1184 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1180 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
1185 return current_ && current_->host()->GetParent(); | 1181 return current_ && current_->host()->GetParent(); |
1186 } | 1182 } |
1187 | 1183 |
1188 } // namespace content | 1184 } // namespace content |
OLD | NEW |