Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 2847443002: PlzNavigate: make NavigationResourceHandler a LayeredResourceHandler (Closed)
Patch Set: Addressed comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/loader/navigation_resource_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "content/browser/appcache/appcache_navigation_handle.h" 10 #include "content/browser/appcache/appcache_navigation_handle.h"
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 return; 806 return;
807 } 807 }
808 808
809 loader_->FollowRedirect(); 809 loader_->FollowRedirect();
810 } 810 }
811 811
812 void NavigationRequest::OnWillProcessResponseChecksComplete( 812 void NavigationRequest::OnWillProcessResponseChecksComplete(
813 NavigationThrottle::ThrottleCheckResult result) { 813 NavigationThrottle::ThrottleCheckResult result) {
814 DCHECK(result != NavigationThrottle::DEFER); 814 DCHECK(result != NavigationThrottle::DEFER);
815 815
816 // If the NavigationThrottles allowed the navigation to continue, have the
817 // processing of the response resume in the network stack.
818 if (result == NavigationThrottle::PROCEED)
819 loader_->ProceedWithResponse();
820
816 // Abort the request if needed. This includes requests that were blocked by 821 // Abort the request if needed. This includes requests that were blocked by
817 // NavigationThrottles and requests that should not commit (e.g. downloads, 822 // NavigationThrottles and requests that should not commit (e.g. downloads,
818 // 204/205s). This will destroy the NavigationRequest. 823 // 204/205s). This will destroy the NavigationRequest.
819 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 824 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
820 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) { 825 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) {
821 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 826 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
822 OnRequestFailed(false, net::ERR_ABORTED); 827 OnRequestFailed(false, net::ERR_ABORTED);
823 828
824 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 829 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
825 // destroyed the NavigationRequest. 830 // destroyed the NavigationRequest.
826 return; 831 return;
827 } 832 }
828 833
829 if (result == NavigationThrottle::BLOCK_RESPONSE) { 834 if (result == NavigationThrottle::BLOCK_RESPONSE) {
830 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE); 835 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE);
831 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 836 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
832 // destroyed the NavigationRequest. 837 // destroyed the NavigationRequest.
833 return; 838 return;
834 } 839 }
835 840
836 // Have the processing of the response resume in the network stack.
837 loader_->ProceedWithResponse();
838
839 CommitNavigation(); 841 CommitNavigation();
840 842
841 // DO NOT ADD CODE after this. The previous call to CommitNavigation caused 843 // DO NOT ADD CODE after this. The previous call to CommitNavigation caused
842 // the destruction of the NavigationRequest. 844 // the destruction of the NavigationRequest.
843 } 845 }
844 846
845 void NavigationRequest::CommitNavigation() { 847 void NavigationRequest::CommitNavigation() {
846 DCHECK(response_ || !ShouldMakeNetworkRequestForURL(common_params_.url) || 848 DCHECK(response_ || !ShouldMakeNetworkRequestForURL(common_params_.url) ||
847 navigation_handle_->IsSameDocument()); 849 navigation_handle_->IsSameDocument());
848 DCHECK(!common_params_.url.SchemeIs(url::kJavaScriptScheme)); 850 DCHECK(!common_params_.url.SchemeIs(url::kJavaScriptScheme));
(...skipping 11 matching lines...) Expand all
860 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 862 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
861 863
862 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 864 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
863 std::move(handle_), common_params_, 865 std::move(handle_), common_params_,
864 request_params_, is_view_source_); 866 request_params_, is_view_source_);
865 867
866 frame_tree_node_->ResetNavigationRequest(true, true); 868 frame_tree_node_->ResetNavigationRequest(true, true);
867 } 869 }
868 870
869 } // namespace content 871 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/navigation_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698