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