OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 (controller_->GetLastCommittedEntry()->GetTransitionType() & | 479 (controller_->GetLastCommittedEntry()->GetTransitionType() & |
480 ui::PAGE_TRANSITION_FORWARD_BACK)) { | 480 ui::PAGE_TRANSITION_FORWARD_BACK)) { |
481 transition_type = ui::PageTransitionFromInt( | 481 transition_type = ui::PageTransitionFromInt( |
482 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); | 482 params.transition | ui::PAGE_TRANSITION_FORWARD_BACK); |
483 } | 483 } |
484 | 484 |
485 delegate_->DidCommitProvisionalLoad(render_frame_host, | 485 delegate_->DidCommitProvisionalLoad(render_frame_host, |
486 params.url, | 486 params.url, |
487 transition_type); | 487 transition_type); |
488 render_frame_host->navigation_handle()->DidCommitNavigation( | 488 render_frame_host->navigation_handle()->DidCommitNavigation( |
489 is_navigation_within_page); | 489 is_navigation_within_page, render_frame_host); |
| 490 render_frame_host->SetNavigationHandle(nullptr); |
490 } | 491 } |
491 | 492 |
492 if (!did_navigate) | 493 if (!did_navigate) |
493 return; // No navigation happened. | 494 return; // No navigation happened. |
494 | 495 |
495 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen | 496 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen |
496 // for the appropriate notification (best) or you can add it to | 497 // for the appropriate notification (best) or you can add it to |
497 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if | 498 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if |
498 // necessary, please). | 499 // necessary, please). |
499 | 500 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 DCHECK(!render_frame_host->GetParent()); | 733 DCHECK(!render_frame_host->GetParent()); |
733 render_frame_host->render_view_host()->Send( | 734 render_frame_host->render_view_host()->Send( |
734 new ViewMsg_EnableViewSourceMode( | 735 new ViewMsg_EnableViewSourceMode( |
735 render_frame_host->render_view_host()->GetRoutingID())); | 736 render_frame_host->render_view_host()->GetRoutingID())); |
736 } | 737 } |
737 | 738 |
738 CheckWebUIRendererDoesNotDisplayNormalURL( | 739 CheckWebUIRendererDoesNotDisplayNormalURL( |
739 render_frame_host, navigation_request->common_params().url); | 740 render_frame_host, navigation_request->common_params().url); |
740 | 741 |
741 navigation_request->TransferNavigationHandleOwnership(render_frame_host); | 742 navigation_request->TransferNavigationHandleOwnership(render_frame_host); |
742 delegate_->ReadyToCommitNavigation(render_frame_host->navigation_handle()); | |
743 render_frame_host->CommitNavigation(response, body.Pass(), | 743 render_frame_host->CommitNavigation(response, body.Pass(), |
744 navigation_request->common_params(), | 744 navigation_request->common_params(), |
745 navigation_request->request_params()); | 745 navigation_request->request_params()); |
746 | 746 |
747 } | 747 } |
748 | 748 |
749 // PlzNavigate | 749 // PlzNavigate |
750 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, | 750 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, |
751 bool has_stale_copy_in_cache, | 751 bool has_stale_copy_in_cache, |
752 int error_code) { | 752 int error_code) { |
(...skipping 10 matching lines...) Expand all Loading... |
763 } | 763 } |
764 | 764 |
765 // Select an appropriate renderer to show the error page. | 765 // Select an appropriate renderer to show the error page. |
766 RenderFrameHostImpl* render_frame_host = | 766 RenderFrameHostImpl* render_frame_host = |
767 frame_tree_node->render_manager()->GetFrameHostForNavigation( | 767 frame_tree_node->render_manager()->GetFrameHostForNavigation( |
768 *navigation_request); | 768 *navigation_request); |
769 CheckWebUIRendererDoesNotDisplayNormalURL( | 769 CheckWebUIRendererDoesNotDisplayNormalURL( |
770 render_frame_host, navigation_request->common_params().url); | 770 render_frame_host, navigation_request->common_params().url); |
771 | 771 |
772 navigation_request->TransferNavigationHandleOwnership(render_frame_host); | 772 navigation_request->TransferNavigationHandleOwnership(render_frame_host); |
773 delegate_->ReadyToCommitNavigation(render_frame_host->navigation_handle()); | |
774 render_frame_host->FailedNavigation(navigation_request->common_params(), | 773 render_frame_host->FailedNavigation(navigation_request->common_params(), |
775 navigation_request->request_params(), | 774 navigation_request->request_params(), |
776 has_stale_copy_in_cache, error_code); | 775 has_stale_copy_in_cache, error_code); |
777 } | 776 } |
778 | 777 |
779 // PlzNavigate | 778 // PlzNavigate |
780 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { | 779 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { |
781 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 780 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
782 switches::kEnableBrowserSideNavigation)); | 781 switches::kEnableBrowserSideNavigation)); |
783 frame_tree_node->ResetNavigationRequest(false); | 782 frame_tree_node->ResetNavigationRequest(false); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 945 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
947 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 946 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
948 } | 947 } |
949 controller_->SetPendingEntry(entry.Pass()); | 948 controller_->SetPendingEntry(entry.Pass()); |
950 if (delegate_) | 949 if (delegate_) |
951 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 950 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
952 } | 951 } |
953 } | 952 } |
954 | 953 |
955 } // namespace content | 954 } // namespace content |
OLD | NEW |