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

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

Issue 2729433003: PlzNavigate: add support for BLOCK_REQUEST during redirects (Closed)
Patch Set: Addressed nits Created 3 years, 9 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 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 708 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
709 result == NavigationThrottle::CANCEL) { 709 result == NavigationThrottle::CANCEL) {
710 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 710 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
711 OnRequestFailed(false, net::ERR_ABORTED); 711 OnRequestFailed(false, net::ERR_ABORTED);
712 712
713 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 713 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
714 // destroyed the NavigationRequest. 714 // destroyed the NavigationRequest.
715 return; 715 return;
716 } 716 }
717 717
718 if (result == NavigationThrottle::BLOCK_REQUEST) {
719 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT);
720
721 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
722 // destroyed the NavigationRequest.
723 return;
724 }
725
718 loader_->FollowRedirect(); 726 loader_->FollowRedirect();
719 } 727 }
720 728
721 void NavigationRequest::OnWillProcessResponseChecksComplete( 729 void NavigationRequest::OnWillProcessResponseChecksComplete(
722 NavigationThrottle::ThrottleCheckResult result) { 730 NavigationThrottle::ThrottleCheckResult result) {
723 DCHECK(result != NavigationThrottle::DEFER); 731 DCHECK(result != NavigationThrottle::DEFER);
724 732
725 // Abort the request if needed. This includes requests that were blocked by 733 // Abort the request if needed. This includes requests that were blocked by
726 // NavigationThrottles and requests that should not commit (e.g. downloads, 734 // NavigationThrottles and requests that should not commit (e.g. downloads,
727 // 204/205s). This will destroy the NavigationRequest. 735 // 204/205s). This will destroy the NavigationRequest.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 777 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
770 778
771 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 779 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
772 common_params_, request_params_, 780 common_params_, request_params_,
773 is_view_source_); 781 is_view_source_);
774 782
775 frame_tree_node_->ResetNavigationRequest(true); 783 frame_tree_node_->ResetNavigationRequest(true);
776 } 784 }
777 785
778 } // namespace content 786 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl_browsertest.cc ('k') | content/public/browser/navigation_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698