| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 6 | 6 |
| 7 #include "base/debug/dump_without_crashing.h" | 7 #include "base/debug/dump_without_crashing.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 9 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| 10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
| 11 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 11 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 12 #include "content/browser/frame_host/debug_urls.h" | 12 #include "content/browser/frame_host/debug_urls.h" |
| 13 #include "content/browser/frame_host/frame_tree_node.h" | 13 #include "content/browser/frame_host/frame_tree_node.h" |
| 14 #include "content/browser/frame_host/navigator.h" | 14 #include "content/browser/frame_host/navigator.h" |
| 15 #include "content/browser/frame_host/navigator_delegate.h" | 15 #include "content/browser/frame_host/navigator_delegate.h" |
| 16 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 16 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 17 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 17 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 18 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 18 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
| 19 #include "content/common/frame_messages.h" | 19 #include "content/common/frame_messages.h" |
| 20 #include "content/common/resource_request_body_impl.h" | 20 #include "content/common/resource_request_body_impl.h" |
| 21 #include "content/common/site_isolation_policy.h" | 21 #include "content/common/site_isolation_policy.h" |
| 22 #include "content/public/browser/content_browser_client.h" | 22 #include "content/public/browser/content_browser_client.h" |
| 23 #include "content/public/browser/navigation_ui_data.h" | 23 #include "content/public/browser/navigation_ui_data.h" |
| 24 #include "content/public/browser/site_instance.h" | 24 #include "content/public/browser/site_instance.h" |
| 25 #include "content/public/common/browser_side_navigation_policy.h" | 25 #include "content/public/common/browser_side_navigation_policy.h" |
| 26 #include "content/public/common/content_client.h" | 26 #include "content/public/common/content_client.h" |
| 27 #include "content/public/common/url_constants.h" | 27 #include "content/public/common/url_constants.h" |
| 28 #include "net/base/net_errors.h" |
| 28 #include "net/url_request/redirect_info.h" | 29 #include "net/url_request/redirect_info.h" |
| 29 #include "url/gurl.h" | 30 #include "url/gurl.h" |
| 30 #include "url/url_constants.h" | 31 #include "url/url_constants.h" |
| 31 | 32 |
| 32 namespace content { | 33 namespace content { |
| 33 | 34 |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 void UpdateThrottleCheckResult( | 37 void UpdateThrottleCheckResult( |
| 37 NavigationThrottle::ThrottleCheckResult* to_update, | 38 NavigationThrottle::ThrottleCheckResult* to_update, |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 bool NavigationHandleImpl::MaybeTransferAndProceed() { | 663 bool NavigationHandleImpl::MaybeTransferAndProceed() { |
| 663 DCHECK_EQ(WILL_PROCESS_RESPONSE, state_); | 664 DCHECK_EQ(WILL_PROCESS_RESPONSE, state_); |
| 664 | 665 |
| 665 // Check if the navigation should transfer. This may result in the | 666 // Check if the navigation should transfer. This may result in the |
| 666 // destruction of this NavigationHandle, and the cancellation of the request. | 667 // destruction of this NavigationHandle, and the cancellation of the request. |
| 667 if (!MaybeTransferAndProceedInternal()) | 668 if (!MaybeTransferAndProceedInternal()) |
| 668 return false; | 669 return false; |
| 669 | 670 |
| 670 // Inform observers that the navigation is now ready to commit, unless a | 671 // Inform observers that the navigation is now ready to commit, unless a |
| 671 // transfer of the navigation failed. | 672 // transfer of the navigation failed. |
| 672 ReadyToCommitNavigation(render_frame_host_); | 673 // PlzNavigate: when a navigation is not set to commit (204/205s/downloads) do |
| 674 // not call ReadyToCommitNavigation. |
| 675 DCHECK(!IsBrowserSideNavigationEnabled() || render_frame_host_ || |
| 676 net_error_code_ == net::ERR_ABORTED); |
| 677 if (!IsBrowserSideNavigationEnabled() || render_frame_host_) |
| 678 ReadyToCommitNavigation(render_frame_host_); |
| 673 return true; | 679 return true; |
| 674 } | 680 } |
| 675 | 681 |
| 676 bool NavigationHandleImpl::MaybeTransferAndProceedInternal() { | 682 bool NavigationHandleImpl::MaybeTransferAndProceedInternal() { |
| 677 DCHECK(render_frame_host_); | 683 DCHECK(render_frame_host_ || (IsBrowserSideNavigationEnabled() && |
| 684 net_error_code_ == net::ERR_ABORTED)); |
| 678 | 685 |
| 679 // PlzNavigate: the final RenderFrameHost handling this navigation has been | 686 // PlzNavigate: the final RenderFrameHost handling this navigation has been |
| 680 // decided before calling WillProcessResponse in | 687 // decided before calling WillProcessResponse in |
| 681 // NavigationRequest::OnResponseStarted. | 688 // NavigationRequest::OnResponseStarted. |
| 682 // TODO(clamy): See if PlzNavigate could use this code to check whether to | 689 // TODO(clamy): See if PlzNavigate could use this code to check whether to |
| 683 // use the RFH determined at the start of the navigation or to switch to | 690 // use the RFH determined at the start of the navigation or to switch to |
| 684 // another one. | 691 // another one. |
| 685 if (IsBrowserSideNavigationEnabled()) | 692 if (IsBrowserSideNavigationEnabled()) |
| 686 return true; | 693 return true; |
| 687 | 694 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 788 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
| 782 | 789 |
| 783 if (throttles_to_register.size() > 0) { | 790 if (throttles_to_register.size() > 0) { |
| 784 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 791 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), |
| 785 throttles_to_register.end()); | 792 throttles_to_register.end()); |
| 786 throttles_to_register.weak_clear(); | 793 throttles_to_register.weak_clear(); |
| 787 } | 794 } |
| 788 } | 795 } |
| 789 | 796 |
| 790 } // namespace content | 797 } // namespace content |
| OLD | NEW |