| 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 DCHECK(result != NavigationThrottle::DEFER); | 687 DCHECK(result != NavigationThrottle::DEFER); |
| 688 | 688 |
| 689 // Abort the request if needed. This includes requests that were blocked by | 689 // Abort the request if needed. This includes requests that were blocked by |
| 690 // NavigationThrottles and requests that should not commit (e.g. downloads, | 690 // NavigationThrottles and requests that should not commit (e.g. downloads, |
| 691 // 204/205s). This will destroy the NavigationRequest. | 691 // 204/205s). This will destroy the NavigationRequest. |
| 692 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 692 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 693 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) { | 693 result == NavigationThrottle::CANCEL || !response_should_be_rendered_) { |
| 694 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 694 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
| 695 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded( | 695 frame_tree_node_->navigator()->DiscardPendingEntryIfNeeded( |
| 696 navigation_handle_.get()); | 696 navigation_handle_.get()); |
| 697 // Select an appropriate RenderFrameHost. |
| 698 RenderFrameHostImpl* render_frame_host = |
| 699 frame_tree_node_->render_manager()->GetFrameHostForNavigation(*this); |
| 700 if (render_frame_host) { |
| 701 render_frame_host->AbortNavigationRequest(common_params().url, |
| 702 net::ERR_ABORTED); |
| 703 } |
| 697 frame_tree_node_->ResetNavigationRequest(false); | 704 frame_tree_node_->ResetNavigationRequest(false); |
| 698 return; | 705 return; |
| 699 } | 706 } |
| 700 | 707 |
| 701 if (result == NavigationThrottle::BLOCK_RESPONSE) { | 708 if (result == NavigationThrottle::BLOCK_RESPONSE) { |
| 702 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE); | 709 OnRequestFailed(false, net::ERR_BLOCKED_BY_RESPONSE); |
| 703 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 710 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 704 // destroyed the NavigationRequest. | 711 // destroyed the NavigationRequest. |
| 705 return; | 712 return; |
| 706 } | 713 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 731 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 738 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 732 | 739 |
| 733 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 740 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 734 common_params_, request_params_, | 741 common_params_, request_params_, |
| 735 is_view_source_); | 742 is_view_source_); |
| 736 | 743 |
| 737 frame_tree_node_->ResetNavigationRequest(true); | 744 frame_tree_node_->ResetNavigationRequest(true); |
| 738 } | 745 } |
| 739 | 746 |
| 740 } // namespace content | 747 } // namespace content |
| OLD | NEW |