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

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

Issue 2632633006: Implement NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE. (Closed)
Patch Set: Moar tests. Created 3 years, 11 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 on_start_checks_complete_closure_.Run(); 561 on_start_checks_complete_closure_.Run();
562 562
563 // Abort the request if needed. This will destroy the NavigationRequest. 563 // Abort the request if needed. This will destroy the NavigationRequest.
564 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 564 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
565 result == NavigationThrottle::CANCEL) { 565 result == NavigationThrottle::CANCEL) {
566 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 566 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
567 frame_tree_node_->ResetNavigationRequest(false); 567 frame_tree_node_->ResetNavigationRequest(false);
568 return; 568 return;
569 } 569 }
570 570
571 if (result == NavigationThrottle::BLOCK_REQUEST) { 571 if (result == NavigationThrottle::BLOCK_REQUEST ||
572 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) {
572 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); 573 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT);
573 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 574 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
574 // destroyed the NavigationRequest. 575 // destroyed the NavigationRequest.
575 return; 576 return;
576 } 577 }
577 578
578 // Use the SiteInstance of the navigating RenderFrameHost to get access to 579 // Use the SiteInstance of the navigating RenderFrameHost to get access to
579 // the StoragePartition. Using the url of the navigation will result in a 580 // the StoragePartition. Using the url of the navigation will result in a
580 // wrong StoragePartition being picked when a WebView is navigating. 581 // wrong StoragePartition being picked when a WebView is navigating.
581 DCHECK_NE(AssociatedSiteInstanceType::NONE, associated_site_instance_type_); 582 DCHECK_NE(AssociatedSiteInstanceType::NONE, associated_site_instance_type_);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 navigation_handle_->appcache_handle(), this); 649 navigation_handle_->appcache_handle(), this);
649 } 650 }
650 651
651 void NavigationRequest::OnRedirectChecksComplete( 652 void NavigationRequest::OnRedirectChecksComplete(
652 NavigationThrottle::ThrottleCheckResult result) { 653 NavigationThrottle::ThrottleCheckResult result) {
653 DCHECK(result != NavigationThrottle::DEFER); 654 DCHECK(result != NavigationThrottle::DEFER);
654 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); 655 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE);
655 656
656 // Abort the request if needed. This will destroy the NavigationRequest. 657 // Abort the request if needed. This will destroy the NavigationRequest.
657 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 658 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
658 result == NavigationThrottle::CANCEL) { 659 result == NavigationThrottle::CANCEL ||
659 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 660 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) {
661 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE,
662 // as well as BLOCK_REQUEST_AND_COLLAPSE if needed.
660 frame_tree_node_->ResetNavigationRequest(false); 663 frame_tree_node_->ResetNavigationRequest(false);
661 return; 664 return;
662 } 665 }
663 666
664 loader_->FollowRedirect(); 667 loader_->FollowRedirect();
665 } 668 }
666 669
667 void NavigationRequest::OnWillProcessResponseChecksComplete( 670 void NavigationRequest::OnWillProcessResponseChecksComplete(
668 NavigationThrottle::ThrottleCheckResult result) { 671 NavigationThrottle::ThrottleCheckResult result) {
669 DCHECK(result != NavigationThrottle::DEFER); 672 DCHECK(result != NavigationThrottle::DEFER);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 716 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
714 717
715 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 718 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
716 common_params_, request_params_, 719 common_params_, request_params_,
717 is_view_source_); 720 is_view_source_);
718 721
719 frame_tree_node_->ResetNavigationRequest(true); 722 frame_tree_node_->ResetNavigationRequest(true);
720 } 723 }
721 724
722 } // namespace content 725 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698