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

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

Issue 2642303002: PlzNavigate: Chrome UI changes for new methods of WebContentsObserver (Closed)
Patch Set: jam@ comments Created 3 years, 10 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 DCHECK(result != NavigationThrottle::DEFER); 568 DCHECK(result != NavigationThrottle::DEFER);
569 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); 569 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE);
570 570
571 if (on_start_checks_complete_closure_) 571 if (on_start_checks_complete_closure_)
572 on_start_checks_complete_closure_.Run(); 572 on_start_checks_complete_closure_.Run();
573 573
574 // Abort the request if needed. This will destroy the NavigationRequest. 574 // Abort the request if needed. This will destroy the NavigationRequest.
575 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 575 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
576 result == NavigationThrottle::CANCEL) { 576 result == NavigationThrottle::CANCEL) {
577 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 577 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
578 frame_tree_node_->ResetNavigationRequest(false); 578 OnRequestFailed(false, net::ERR_ABORTED);
579 return; 579 return;
580 } 580 }
581 581
582 if (result == NavigationThrottle::BLOCK_REQUEST) { 582 if (result == NavigationThrottle::BLOCK_REQUEST) {
583 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); 583 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT);
584 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 584 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
585 // destroyed the NavigationRequest. 585 // destroyed the NavigationRequest.
586 return; 586 return;
587 } 587 }
588 588
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 661
662 void NavigationRequest::OnRedirectChecksComplete( 662 void NavigationRequest::OnRedirectChecksComplete(
663 NavigationThrottle::ThrottleCheckResult result) { 663 NavigationThrottle::ThrottleCheckResult result) {
664 DCHECK(result != NavigationThrottle::DEFER); 664 DCHECK(result != NavigationThrottle::DEFER);
665 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); 665 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE);
666 666
667 // Abort the request if needed. This will destroy the NavigationRequest. 667 // Abort the request if needed. This will destroy the NavigationRequest.
668 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 668 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
669 result == NavigationThrottle::CANCEL) { 669 result == NavigationThrottle::CANCEL) {
670 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 670 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
671 frame_tree_node_->ResetNavigationRequest(false); 671 OnRequestFailed(false, net::ERR_ABORTED);
672 return; 672 return;
673 } 673 }
674 674
675 loader_->FollowRedirect(); 675 loader_->FollowRedirect();
676 } 676 }
677 677
678 void NavigationRequest::OnWillProcessResponseChecksComplete( 678 void NavigationRequest::OnWillProcessResponseChecksComplete(
679 NavigationThrottle::ThrottleCheckResult result) { 679 NavigationThrottle::ThrottleCheckResult result) {
680 DCHECK(result != NavigationThrottle::DEFER); 680 DCHECK(result != NavigationThrottle::DEFER);
681 681
682 // Abort the request if needed. This includes requests that were blocked by 682 // Abort the request if needed. This includes requests that were blocked by
683 // NavigationThrottles and requests that should not commit (e.g. downloads, 683 // NavigationThrottles and requests that should not commit (e.g. downloads,
684 // 204/205s). This will destroy the NavigationRequest. 684 // 204/205s). This will destroy the NavigationRequest.
685 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 685 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
686 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) { 686 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) {
687 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 687 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
688 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded( 688 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded(
689 navigation_handle_.get()); 689 navigation_handle_.get());
690 frame_tree_node_->ResetNavigationRequest(false); 690 OnRequestFailed(false, net::ERR_ABORTED);
691 return; 691 return;
692 } 692 }
693 693
694 if (result == NavigationThrottle::BLOCK_RESPONSE) { 694 if (result == NavigationThrottle::BLOCK_RESPONSE) {
695 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE); 695 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE);
696 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 696 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
697 // destroyed the NavigationRequest. 697 // destroyed the NavigationRequest.
698 return; 698 return;
699 } 699 }
700 700
(...skipping 23 matching lines...) Expand all
724 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 724 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
725 725
726 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 726 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
727 common_params_, request_params_, 727 common_params_, request_params_,
728 is_view_source_); 728 is_view_source_);
729 729
730 frame_tree_node_->ResetNavigationRequest(true); 730 frame_tree_node_->ResetNavigationRequest(true);
731 } 731 }
732 732
733 } // namespace content 733 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698