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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // Note Page.setControlNavigations is intended to control navigations in the | 365 // Note Page.setControlNavigations is intended to control navigations in the |
366 // main frame and all child frames and |page_handler_| only exists for the | 366 // main frame and all child frames and |page_handler_| only exists for the |
367 // main frame. | 367 // main frame. |
368 if (agent_host && agent_host->page_handler_) { | 368 if (agent_host && agent_host->page_handler_) { |
369 return agent_host->page_handler_->CreateThrottleForNavigation( | 369 return agent_host->page_handler_->CreateThrottleForNavigation( |
370 navigation_handle); | 370 navigation_handle); |
371 } | 371 } |
372 return nullptr; | 372 return nullptr; |
373 } | 373 } |
374 | 374 |
| 375 // static |
| 376 void RenderFrameDevToolsAgentHost::WebContentsCreated( |
| 377 WebContents* web_contents) { |
| 378 if (ShouldForceCreation()) { |
| 379 // Force agent host. |
| 380 DevToolsAgentHost::GetOrCreateFor(web_contents); |
| 381 } |
| 382 } |
| 383 |
375 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( | 384 RenderFrameDevToolsAgentHost::RenderFrameDevToolsAgentHost( |
376 RenderFrameHostImpl* host) | 385 RenderFrameHostImpl* host) |
377 : DevToolsAgentHostImpl(base::GenerateGUID()), | 386 : DevToolsAgentHostImpl(base::GenerateGUID()), |
378 browser_handler_(new devtools::browser::BrowserHandler()), | 387 browser_handler_(new devtools::browser::BrowserHandler()), |
379 dom_handler_(new devtools::dom::DOMHandler()), | 388 dom_handler_(new devtools::dom::DOMHandler()), |
380 input_handler_(new devtools::input::InputHandler()), | 389 input_handler_(new devtools::input::InputHandler()), |
381 inspector_handler_(new devtools::inspector::InspectorHandler()), | 390 inspector_handler_(new devtools::inspector::InspectorHandler()), |
382 io_handler_(new devtools::io::IOHandler(GetIOContext())), | 391 io_handler_(new devtools::io::IOHandler(GetIOContext())), |
383 network_handler_(new devtools::network::NetworkHandler()), | 392 network_handler_(new devtools::network::NetworkHandler()), |
384 page_handler_(nullptr), | 393 page_handler_(nullptr), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 CommitPending(); | 435 CommitPending(); |
427 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); | 436 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); |
428 | 437 |
429 if (web_contents() && web_contents()->GetCrashedStatus() != | 438 if (web_contents() && web_contents()->GetCrashedStatus() != |
430 base::TERMINATION_STATUS_STILL_RUNNING) { | 439 base::TERMINATION_STATUS_STILL_RUNNING) { |
431 current_frame_crashed_ = true; | 440 current_frame_crashed_ = true; |
432 } | 441 } |
433 | 442 |
434 g_instances.Get().push_back(this); | 443 g_instances.Get().push_back(this); |
435 AddRef(); // Balanced in RenderFrameHostDestroyed. | 444 AddRef(); // Balanced in RenderFrameHostDestroyed. |
| 445 NotifyCreated(); |
436 } | 446 } |
437 | 447 |
438 void RenderFrameDevToolsAgentHost::SetPending(RenderFrameHostImpl* host) { | 448 void RenderFrameDevToolsAgentHost::SetPending(RenderFrameHostImpl* host) { |
439 DCHECK(!pending_); | 449 DCHECK(!pending_); |
440 current_frame_crashed_ = false; | 450 current_frame_crashed_ = false; |
441 pending_.reset(new FrameHostHolder(this, host)); | 451 pending_.reset(new FrameHostHolder(this, host)); |
442 if (IsAttached()) | 452 if (IsAttached()) |
443 pending_->Reattach(current_.get()); | 453 pending_->Reattach(current_.get()); |
444 | 454 |
445 // Can only be null in constructor. | 455 // Can only be null in constructor. |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 RenderFrameHost* host) { | 1096 RenderFrameHost* host) { |
1087 return (current_ && current_->host() == host) || | 1097 return (current_ && current_->host() == host) || |
1088 (pending_ && pending_->host() == host); | 1098 (pending_ && pending_->host() == host); |
1089 } | 1099 } |
1090 | 1100 |
1091 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1101 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
1092 return current_ && current_->host()->GetParent(); | 1102 return current_ && current_->host()->GetParent(); |
1093 } | 1103 } |
1094 | 1104 |
1095 } // namespace content | 1105 } // namespace content |
OLD | NEW |