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

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

Issue 2632633006: Implement NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE. (Closed)
Patch Set: Rebase. 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 690 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
691 result == NavigationThrottle::CANCEL) { 691 result == NavigationThrottle::CANCEL) {
692 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 692 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
693 OnRequestFailed(false, net::ERR_ABORTED); 693 OnRequestFailed(false, net::ERR_ABORTED);
694 694
695 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 695 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
696 // destroyed the NavigationRequest. 696 // destroyed the NavigationRequest.
697 return; 697 return;
698 } 698 }
699 699
700 if (result == NavigationThrottle::BLOCK_REQUEST) { 700 if (result == NavigationThrottle::BLOCK_REQUEST ||
701 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) {
701 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); 702 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT);
702 703
703 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 704 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
704 // destroyed the NavigationRequest. 705 // destroyed the NavigationRequest.
705 return; 706 return;
706 } 707 }
707 708
708 // Use the SiteInstance of the navigating RenderFrameHost to get access to 709 // Use the SiteInstance of the navigating RenderFrameHost to get access to
709 // the StoragePartition. Using the url of the navigation will result in a 710 // the StoragePartition. Using the url of the navigation will result in a
710 // wrong StoragePartition being picked when a WebView is navigating. 711 // wrong StoragePartition being picked when a WebView is navigating.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 } 784 }
784 785
785 void NavigationRequest::OnRedirectChecksComplete( 786 void NavigationRequest::OnRedirectChecksComplete(
786 NavigationThrottle::ThrottleCheckResult result) { 787 NavigationThrottle::ThrottleCheckResult result) {
787 DCHECK(result != NavigationThrottle::DEFER); 788 DCHECK(result != NavigationThrottle::DEFER);
788 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); 789 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE);
789 790
790 // Abort the request if needed. This will destroy the NavigationRequest. 791 // Abort the request if needed. This will destroy the NavigationRequest.
791 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 792 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
792 result == NavigationThrottle::CANCEL) { 793 result == NavigationThrottle::CANCEL) {
793 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 794 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE if needed.
794 OnRequestFailed(false, net::ERR_ABORTED); 795 OnRequestFailed(false, net::ERR_ABORTED);
795 796
796 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 797 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
797 // destroyed the NavigationRequest. 798 // destroyed the NavigationRequest.
798 return; 799 return;
799 } 800 }
800 801
801 if (result == NavigationThrottle::BLOCK_REQUEST) { 802 if (result == NavigationThrottle::BLOCK_REQUEST ||
803 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) {
802 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); 804 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT);
803
804 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 805 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
805 // destroyed the NavigationRequest. 806 // destroyed the NavigationRequest.
806 return; 807 return;
807 } 808 }
808 809
809 loader_->FollowRedirect(); 810 loader_->FollowRedirect();
810 } 811 }
811 812
812 void NavigationRequest::OnWillProcessResponseChecksComplete( 813 void NavigationRequest::OnWillProcessResponseChecksComplete(
813 NavigationThrottle::ThrottleCheckResult result) { 814 NavigationThrottle::ThrottleCheckResult result) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 863 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
863 864
864 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 865 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
865 std::move(handle_), common_params_, 866 std::move(handle_), common_params_,
866 request_params_, is_view_source_); 867 request_params_, is_view_source_);
867 868
868 frame_tree_node_->ResetNavigationRequest(true, true); 869 frame_tree_node_->ResetNavigationRequest(true, true);
869 } 870 }
870 871
871 } // namespace content 872 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698