Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 DCHECK(result != NavigationThrottle::DEFER); | 575 DCHECK(result != NavigationThrottle::DEFER); |
| 576 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); | 576 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); |
| 577 | 577 |
| 578 if (on_start_checks_complete_closure_) | 578 if (on_start_checks_complete_closure_) |
| 579 on_start_checks_complete_closure_.Run(); | 579 on_start_checks_complete_closure_.Run(); |
| 580 | 580 |
| 581 // Abort the request if needed. This will destroy the NavigationRequest. | 581 // Abort the request if needed. This will destroy the NavigationRequest. |
| 582 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 582 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 583 result == NavigationThrottle::CANCEL) { | 583 result == NavigationThrottle::CANCEL) { |
| 584 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 584 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
| 585 frame_tree_node_->ResetNavigationRequest(false); | 585 OnRequestFailed(false, net::ERR_ABORTED); |
| 586 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | |
|
nasko
2017/02/07 21:25:26
nit: I'd add an empty line above the comment to ma
clamy
2017/02/08 16:34:16
Done.
| |
| 587 // destroyed the NavigationRequest. | |
| 586 return; | 588 return; |
| 587 } | 589 } |
| 588 | 590 |
| 589 if (result == NavigationThrottle::BLOCK_REQUEST) { | 591 if (result == NavigationThrottle::BLOCK_REQUEST) { |
| 590 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); | 592 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); |
| 591 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 593 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 592 // destroyed the NavigationRequest. | 594 // destroyed the NavigationRequest. |
| 593 return; | 595 return; |
| 594 } | 596 } |
| 595 | 597 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 | 670 |
| 669 void NavigationRequest::OnRedirectChecksComplete( | 671 void NavigationRequest::OnRedirectChecksComplete( |
| 670 NavigationThrottle::ThrottleCheckResult result) { | 672 NavigationThrottle::ThrottleCheckResult result) { |
| 671 DCHECK(result != NavigationThrottle::DEFER); | 673 DCHECK(result != NavigationThrottle::DEFER); |
| 672 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); | 674 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); |
| 673 | 675 |
| 674 // Abort the request if needed. This will destroy the NavigationRequest. | 676 // Abort the request if needed. This will destroy the NavigationRequest. |
| 675 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 677 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 676 result == NavigationThrottle::CANCEL) { | 678 result == NavigationThrottle::CANCEL) { |
| 677 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 679 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
| 678 frame_tree_node_->ResetNavigationRequest(false); | 680 OnRequestFailed(false, net::ERR_ABORTED); |
| 681 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | |
| 682 // destroyed the NavigationRequest. | |
| 679 return; | 683 return; |
| 680 } | 684 } |
| 681 | 685 |
| 682 loader_->FollowRedirect(); | 686 loader_->FollowRedirect(); |
| 683 } | 687 } |
| 684 | 688 |
| 685 void NavigationRequest::OnWillProcessResponseChecksComplete( | 689 void NavigationRequest::OnWillProcessResponseChecksComplete( |
| 686 NavigationThrottle::ThrottleCheckResult result) { | 690 NavigationThrottle::ThrottleCheckResult result) { |
| 687 DCHECK(result != NavigationThrottle::DEFER); | 691 DCHECK(result != NavigationThrottle::DEFER); |
| 688 | 692 |
| 689 // Abort the request if needed. This includes requests that were blocked by | 693 // Abort the request if needed. This includes requests that were blocked by |
| 690 // NavigationThrottles and requests that should not commit (e.g. downloads, | 694 // NavigationThrottles and requests that should not commit (e.g. downloads, |
| 691 // 204/205s). This will destroy the NavigationRequest. | 695 // 204/205s). This will destroy the NavigationRequest. |
| 692 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 696 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 693 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) { | 697 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) { |
| 694 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 698 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
| 695 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded( | 699 OnRequestFailed(false, net::ERR_ABORTED); |
| 696 navigation_handle_.get()); | 700 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 697 frame_tree_node_->ResetNavigationRequest(false); | 701 // destroyed the NavigationRequest. |
| 698 return; | 702 return; |
| 699 } | 703 } |
| 700 | 704 |
| 701 if (result == NavigationThrottle::BLOCK_RESPONSE) { | 705 if (result == NavigationThrottle::BLOCK_RESPONSE) { |
| 702 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE); | 706 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE); |
| 703 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 707 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 704 // destroyed the NavigationRequest. | 708 // destroyed the NavigationRequest. |
| 705 return; | 709 return; |
| 706 } | 710 } |
| 707 | 711 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 731 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 735 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 732 | 736 |
| 733 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 737 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 734 common_params_, request_params_, | 738 common_params_, request_params_, |
| 735 is_view_source_); | 739 is_view_source_); |
| 736 | 740 |
| 737 frame_tree_node_->ResetNavigationRequest(true); | 741 frame_tree_node_->ResetNavigationRequest(true); |
| 738 } | 742 } |
| 739 | 743 |
| 740 } // namespace content | 744 } // namespace content |
| OLD | NEW |