| 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 if (did_navigate && | 478 if (did_navigate && |
| 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 render_frame_host); |
| 490 render_frame_host->SetNavigationHandle(nullptr); |
| 489 } | 491 } |
| 490 | 492 |
| 491 if (!did_navigate) | 493 if (!did_navigate) |
| 492 return; // No navigation happened. | 494 return; // No navigation happened. |
| 493 | 495 |
| 494 // 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 |
| 495 // for the appropriate notification (best) or you can add it to | 497 // for the appropriate notification (best) or you can add it to |
| 496 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if | 498 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if |
| 497 // necessary, please). | 499 // necessary, please). |
| 498 | 500 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 DCHECK(!render_frame_host->GetParent()); | 733 DCHECK(!render_frame_host->GetParent()); |
| 732 render_frame_host->render_view_host()->Send( | 734 render_frame_host->render_view_host()->Send( |
| 733 new ViewMsg_EnableViewSourceMode( | 735 new ViewMsg_EnableViewSourceMode( |
| 734 render_frame_host->render_view_host()->GetRoutingID())); | 736 render_frame_host->render_view_host()->GetRoutingID())); |
| 735 } | 737 } |
| 736 | 738 |
| 737 CheckWebUIRendererDoesNotDisplayNormalURL( | 739 CheckWebUIRendererDoesNotDisplayNormalURL( |
| 738 render_frame_host, navigation_request->common_params().url); | 740 render_frame_host, navigation_request->common_params().url); |
| 739 | 741 |
| 740 navigation_request->TransferNavigationHandleOwnership(render_frame_host); | 742 navigation_request->TransferNavigationHandleOwnership(render_frame_host); |
| 741 delegate_->ReadyToCommitNavigation(render_frame_host->navigation_handle()); | |
| 742 render_frame_host->CommitNavigation(response, body.Pass(), | 743 render_frame_host->CommitNavigation(response, body.Pass(), |
| 743 navigation_request->common_params(), | 744 navigation_request->common_params(), |
| 744 navigation_request->request_params()); | 745 navigation_request->request_params()); |
| 745 | 746 |
| 746 } | 747 } |
| 747 | 748 |
| 748 // PlzNavigate | 749 // PlzNavigate |
| 749 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, | 750 void NavigatorImpl::FailedNavigation(FrameTreeNode* frame_tree_node, |
| 750 bool has_stale_copy_in_cache, | 751 bool has_stale_copy_in_cache, |
| 751 int error_code) { | 752 int error_code) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 762 } | 763 } |
| 763 | 764 |
| 764 // Select an appropriate renderer to show the error page. | 765 // Select an appropriate renderer to show the error page. |
| 765 RenderFrameHostImpl* render_frame_host = | 766 RenderFrameHostImpl* render_frame_host = |
| 766 frame_tree_node->render_manager()->GetFrameHostForNavigation( | 767 frame_tree_node->render_manager()->GetFrameHostForNavigation( |
| 767 *navigation_request); | 768 *navigation_request); |
| 768 CheckWebUIRendererDoesNotDisplayNormalURL( | 769 CheckWebUIRendererDoesNotDisplayNormalURL( |
| 769 render_frame_host, navigation_request->common_params().url); | 770 render_frame_host, navigation_request->common_params().url); |
| 770 | 771 |
| 771 navigation_request->TransferNavigationHandleOwnership(render_frame_host); | 772 navigation_request->TransferNavigationHandleOwnership(render_frame_host); |
| 772 delegate_->ReadyToCommitNavigation(render_frame_host->navigation_handle()); | |
| 773 render_frame_host->FailedNavigation(navigation_request->common_params(), | 773 render_frame_host->FailedNavigation(navigation_request->common_params(), |
| 774 navigation_request->request_params(), | 774 navigation_request->request_params(), |
| 775 has_stale_copy_in_cache, error_code); | 775 has_stale_copy_in_cache, error_code); |
| 776 } | 776 } |
| 777 | 777 |
| 778 // PlzNavigate | 778 // PlzNavigate |
| 779 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { | 779 void NavigatorImpl::CancelNavigation(FrameTreeNode* frame_tree_node) { |
| 780 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 780 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 781 switches::kEnableBrowserSideNavigation)); | 781 switches::kEnableBrowserSideNavigation)); |
| 782 frame_tree_node->ResetNavigationRequest(false); | 782 frame_tree_node->ResetNavigationRequest(false); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 entry->set_should_replace_entry(pending_entry->should_replace_entry()); | 945 entry->set_should_replace_entry(pending_entry->should_replace_entry()); |
| 946 entry->SetRedirectChain(pending_entry->GetRedirectChain()); | 946 entry->SetRedirectChain(pending_entry->GetRedirectChain()); |
| 947 } | 947 } |
| 948 controller_->SetPendingEntry(entry.Pass()); | 948 controller_->SetPendingEntry(entry.Pass()); |
| 949 if (delegate_) | 949 if (delegate_) |
| 950 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 950 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
| 951 } | 951 } |
| 952 } | 952 } |
| 953 | 953 |
| 954 } // namespace content | 954 } // namespace content |
| OLD | NEW |