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

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

Issue 2847443002: PlzNavigate: make NavigationResourceHandler a LayeredResourceHandler (Closed)
Patch Set: Removed one unit test 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
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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 return; 786 return;
787 } 787 }
788 788
789 loader_->FollowRedirect(); 789 loader_->FollowRedirect();
790 } 790 }
791 791
792 void NavigationRequest::OnWillProcessResponseChecksComplete( 792 void NavigationRequest::OnWillProcessResponseChecksComplete(
793 NavigationThrottle::ThrottleCheckResult result) { 793 NavigationThrottle::ThrottleCheckResult result) {
794 DCHECK(result != NavigationThrottle::DEFER); 794 DCHECK(result != NavigationThrottle::DEFER);
795 795
796 // If the NavigationThrottles allowed the navigation to continue, have the
797 // processing of the response resume in the network stack.
798 if (result == NavigationThrottle::PROCEED)
799 loader_->ProceedWithResponse();
mmenke 2017/04/28 16:02:20 Why move this? This seems to be exclusive to the
clamy 2017/05/02 15:05:44 Because in the case of downloads response_should_b
mmenke 2017/05/02 15:55:39 Thanks! Missed that case.
800
796 // Abort the request if needed. This includes requests that were blocked by 801 // Abort the request if needed. This includes requests that were blocked by
797 // NavigationThrottles and requests that should not commit (e.g. downloads, 802 // NavigationThrottles and requests that should not commit (e.g. downloads,
798 // 204/205s). This will destroy the NavigationRequest. 803 // 204/205s). This will destroy the NavigationRequest.
799 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 804 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
800 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) { 805 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) {
801 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 806 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
802 OnRequestFailed(false, net::ERR_ABORTED); 807 OnRequestFailed(false, net::ERR_ABORTED);
803 808
804 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 809 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
805 // destroyed the NavigationRequest. 810 // destroyed the NavigationRequest.
806 return; 811 return;
807 } 812 }
808 813
809 if (result == NavigationThrottle::BLOCK_RESPONSE) { 814 if (result == NavigationThrottle::BLOCK_RESPONSE) {
810 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE); 815 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE);
811 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 816 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
812 // destroyed the NavigationRequest. 817 // destroyed the NavigationRequest.
813 return; 818 return;
814 } 819 }
815 820
816 // Have the processing of the response resume in the network stack.
817 loader_->ProceedWithResponse();
818
819 CommitNavigation(); 821 CommitNavigation();
820 822
821 // DO NOT ADD CODE after this. The previous call to CommitNavigation caused 823 // DO NOT ADD CODE after this. The previous call to CommitNavigation caused
822 // the destruction of the NavigationRequest. 824 // the destruction of the NavigationRequest.
823 } 825 }
824 826
825 void NavigationRequest::CommitNavigation() { 827 void NavigationRequest::CommitNavigation() {
826 DCHECK(response_ || !ShouldMakeNetworkRequestForURL(common_params_.url) || 828 DCHECK(response_ || !ShouldMakeNetworkRequestForURL(common_params_.url) ||
827 navigation_handle_->IsSameDocument()); 829 navigation_handle_->IsSameDocument());
828 DCHECK(!common_params_.url.SchemeIs(url::kJavaScriptScheme)); 830 DCHECK(!common_params_.url.SchemeIs(url::kJavaScriptScheme));
(...skipping 11 matching lines...) Expand all
840 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 842 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
841 843
842 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 844 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
843 std::move(handle_), common_params_, 845 std::move(handle_), common_params_,
844 request_params_, is_view_source_); 846 request_params_, is_view_source_);
845 847
846 frame_tree_node_->ResetNavigationRequest(true, true); 848 frame_tree_node_->ResetNavigationRequest(true, true);
847 } 849 }
848 850
849 } // namespace content 851 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698