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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 void RenderFrameDevToolsAgentHost::OnBeforeNavigation( | 375 void RenderFrameDevToolsAgentHost::OnBeforeNavigation( |
376 NavigationHandle* navigation_handle) { | 376 NavigationHandle* navigation_handle) { |
377 FrameTreeNode* frame_tree_node = | 377 FrameTreeNode* frame_tree_node = |
378 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); | 378 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); |
379 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); | 379 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); |
380 if (agent_host) | 380 if (agent_host) |
381 agent_host->AboutToNavigate(navigation_handle); | 381 agent_host->AboutToNavigate(navigation_handle); |
382 } | 382 } |
383 | 383 |
384 // static | 384 // static |
| 385 void RenderFrameDevToolsAgentHost::OnFailedNavigation( |
| 386 RenderFrameHost* host, |
| 387 const CommonNavigationParams& common_params, |
| 388 const BeginNavigationParams& begin_params, |
| 389 net::Error error_code) { |
| 390 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(host); |
| 391 if (agent_host) |
| 392 agent_host->OnFailedNavigation(common_params, begin_params, error_code); |
| 393 } |
| 394 |
| 395 // static |
385 std::unique_ptr<NavigationThrottle> | 396 std::unique_ptr<NavigationThrottle> |
386 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation( | 397 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation( |
387 NavigationHandle* navigation_handle) { | 398 NavigationHandle* navigation_handle) { |
388 FrameTreeNode* frame_tree_node = | 399 FrameTreeNode* frame_tree_node = |
389 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); | 400 static_cast<NavigationHandleImpl*>(navigation_handle)->frame_tree_node(); |
390 while (frame_tree_node && frame_tree_node->parent()) { | 401 while (frame_tree_node && frame_tree_node->parent()) { |
391 frame_tree_node = frame_tree_node->parent(); | 402 frame_tree_node = frame_tree_node->parent(); |
392 } | 403 } |
393 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); | 404 RenderFrameDevToolsAgentHost* agent_host = FindAgentHost(frame_tree_node); |
394 // Note Page.setControlNavigations is intended to control navigations in the | 405 // Note Page.setControlNavigations is intended to control navigations in the |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 void RenderFrameDevToolsAgentHost::AboutToNavigate( | 724 void RenderFrameDevToolsAgentHost::AboutToNavigate( |
714 NavigationHandle* navigation_handle) { | 725 NavigationHandle* navigation_handle) { |
715 if (!IsBrowserSideNavigationEnabled()) | 726 if (!IsBrowserSideNavigationEnabled()) |
716 return; | 727 return; |
717 DCHECK(current_); | 728 DCHECK(current_); |
718 navigating_handles_.insert(navigation_handle); | 729 navigating_handles_.insert(navigation_handle); |
719 current_->Suspend(); | 730 current_->Suspend(); |
720 DCHECK(CheckConsistency()); | 731 DCHECK(CheckConsistency()); |
721 } | 732 } |
722 | 733 |
| 734 void RenderFrameDevToolsAgentHost::OnFailedNavigation( |
| 735 const CommonNavigationParams& common_params, |
| 736 const BeginNavigationParams& begin_params, |
| 737 net::Error error_code) { |
| 738 DCHECK(IsBrowserSideNavigationEnabled()); |
| 739 if (!session()) |
| 740 return; |
| 741 |
| 742 protocol::NetworkHandler* handler = |
| 743 protocol::NetworkHandler::FromSession(session()); |
| 744 if (!handler) |
| 745 return; |
| 746 |
| 747 handler->NavigationFailed(common_params, begin_params, error_code); |
| 748 } |
| 749 |
723 void RenderFrameDevToolsAgentHost::RenderFrameHostChanged( | 750 void RenderFrameDevToolsAgentHost::RenderFrameHostChanged( |
724 RenderFrameHost* old_host, | 751 RenderFrameHost* old_host, |
725 RenderFrameHost* new_host) { | 752 RenderFrameHost* new_host) { |
726 // CommitPending may destruct |this|. | 753 // CommitPending may destruct |this|. |
727 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); | 754 scoped_refptr<RenderFrameDevToolsAgentHost> protect(this); |
728 | 755 |
729 if (session()) | 756 if (session()) |
730 protocol::TargetHandler::FromSession(session())->UpdateFrames(); | 757 protocol::TargetHandler::FromSession(session())->UpdateFrames(); |
731 | 758 |
732 if (IsBrowserSideNavigationEnabled()) | 759 if (IsBrowserSideNavigationEnabled()) |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 RenderFrameHost* host) { | 1179 RenderFrameHost* host) { |
1153 return (current_ && current_->host() == host) || | 1180 return (current_ && current_->host() == host) || |
1154 (pending_ && pending_->host() == host); | 1181 (pending_ && pending_->host() == host); |
1155 } | 1182 } |
1156 | 1183 |
1157 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1184 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
1158 return current_ && current_->host()->GetParent(); | 1185 return current_ && current_->host()->GetParent(); |
1159 } | 1186 } |
1160 | 1187 |
1161 } // namespace content | 1188 } // namespace content |
OLD | NEW |