| 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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 670 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 671 result == NavigationThrottle::CANCEL) { | 671 result == NavigationThrottle::CANCEL) { |
| 672 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 672 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
| 673 OnRequestFailed(false, net::ERR_ABORTED); | 673 OnRequestFailed(false, net::ERR_ABORTED); |
| 674 | 674 |
| 675 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 675 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 676 // destroyed the NavigationRequest. | 676 // destroyed the NavigationRequest. |
| 677 return; | 677 return; |
| 678 } | 678 } |
| 679 | 679 |
| 680 if (result == NavigationThrottle::BLOCK_REQUEST) { | 680 if (result == NavigationThrottle::BLOCK_REQUEST || |
| 681 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) { |
| 681 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); | 682 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); |
| 682 | 683 |
| 683 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 684 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 684 // destroyed the NavigationRequest. | 685 // destroyed the NavigationRequest. |
| 685 return; | 686 return; |
| 686 } | 687 } |
| 687 | 688 |
| 688 // Use the SiteInstance of the navigating RenderFrameHost to get access to | 689 // Use the SiteInstance of the navigating RenderFrameHost to get access to |
| 689 // the StoragePartition. Using the url of the navigation will result in a | 690 // the StoragePartition. Using the url of the navigation will result in a |
| 690 // wrong StoragePartition being picked when a WebView is navigating. | 691 // wrong StoragePartition being picked when a WebView is navigating. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 } | 764 } |
| 764 | 765 |
| 765 void NavigationRequest::OnRedirectChecksComplete( | 766 void NavigationRequest::OnRedirectChecksComplete( |
| 766 NavigationThrottle::ThrottleCheckResult result) { | 767 NavigationThrottle::ThrottleCheckResult result) { |
| 767 DCHECK(result != NavigationThrottle::DEFER); | 768 DCHECK(result != NavigationThrottle::DEFER); |
| 768 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); | 769 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); |
| 769 | 770 |
| 770 // Abort the request if needed. This will destroy the NavigationRequest. | 771 // Abort the request if needed. This will destroy the NavigationRequest. |
| 771 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 772 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 772 result == NavigationThrottle::CANCEL) { | 773 result == NavigationThrottle::CANCEL) { |
| 773 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 774 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE if needed. |
| 774 OnRequestFailed(false, net::ERR_ABORTED); | 775 OnRequestFailed(false, net::ERR_ABORTED); |
| 775 | 776 |
| 776 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 777 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 777 // destroyed the NavigationRequest. | 778 // destroyed the NavigationRequest. |
| 778 return; | 779 return; |
| 779 } | 780 } |
| 780 | 781 |
| 781 if (result == NavigationThrottle::BLOCK_REQUEST) { | 782 if (result == NavigationThrottle::BLOCK_REQUEST || |
| 783 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) { |
| 782 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); | 784 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); |
| 783 | |
| 784 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 785 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 785 // destroyed the NavigationRequest. | 786 // destroyed the NavigationRequest. |
| 786 return; | 787 return; |
| 787 } | 788 } |
| 788 | 789 |
| 789 loader_->FollowRedirect(); | 790 loader_->FollowRedirect(); |
| 790 } | 791 } |
| 791 | 792 |
| 792 void NavigationRequest::OnWillProcessResponseChecksComplete( | 793 void NavigationRequest::OnWillProcessResponseChecksComplete( |
| 793 NavigationThrottle::ThrottleCheckResult result) { | 794 NavigationThrottle::ThrottleCheckResult result) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 841 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 841 | 842 |
| 842 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 843 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 843 std::move(handle_), common_params_, | 844 std::move(handle_), common_params_, |
| 844 request_params_, is_view_source_); | 845 request_params_, is_view_source_); |
| 845 | 846 |
| 846 frame_tree_node_->ResetNavigationRequest(true, true); | 847 frame_tree_node_->ResetNavigationRequest(true, true); |
| 847 } | 848 } |
| 848 | 849 |
| 849 } // namespace content | 850 } // namespace content |
| OLD | NEW |