| 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 569 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 570 result == NavigationThrottle::CANCEL) { | 570 result == NavigationThrottle::CANCEL) { |
| 571 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 571 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
| 572 OnRequestFailed(false, net::ERR_ABORTED); | 572 OnRequestFailed(false, net::ERR_ABORTED); |
| 573 | 573 |
| 574 // 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 |
| 575 // destroyed the NavigationRequest. | 575 // destroyed the NavigationRequest. |
| 576 return; | 576 return; |
| 577 } | 577 } |
| 578 | 578 |
| 579 if (result == NavigationThrottle::BLOCK_REQUEST) { | 579 if (result == NavigationThrottle::BLOCK_REQUEST || |
| 580 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) { |
| 580 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); | 581 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); |
| 581 | 582 |
| 582 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 583 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 583 // destroyed the NavigationRequest. | 584 // destroyed the NavigationRequest. |
| 584 return; | 585 return; |
| 585 } | 586 } |
| 586 | 587 |
| 587 // Use the SiteInstance of the navigating RenderFrameHost to get access to | 588 // Use the SiteInstance of the navigating RenderFrameHost to get access to |
| 588 // the StoragePartition. Using the url of the navigation will result in a | 589 // the StoragePartition. Using the url of the navigation will result in a |
| 589 // wrong StoragePartition being picked when a WebView is navigating. | 590 // wrong StoragePartition being picked when a WebView is navigating. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 navigation_handle_->appcache_handle(), this); | 658 navigation_handle_->appcache_handle(), this); |
| 658 } | 659 } |
| 659 | 660 |
| 660 void NavigationRequest::OnRedirectChecksComplete( | 661 void NavigationRequest::OnRedirectChecksComplete( |
| 661 NavigationThrottle::ThrottleCheckResult result) { | 662 NavigationThrottle::ThrottleCheckResult result) { |
| 662 DCHECK(result != NavigationThrottle::DEFER); | 663 DCHECK(result != NavigationThrottle::DEFER); |
| 663 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); | 664 DCHECK(result != NavigationThrottle::BLOCK_RESPONSE); |
| 664 | 665 |
| 665 // Abort the request if needed. This will destroy the NavigationRequest. | 666 // Abort the request if needed. This will destroy the NavigationRequest. |
| 666 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 667 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
| 667 result == NavigationThrottle::CANCEL) { | 668 result == NavigationThrottle::CANCEL || |
| 668 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 669 result == NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE) { |
| 670 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE, |
| 671 // as well as BLOCK_REQUEST_AND_COLLAPSE if needed. |
| 669 OnRequestFailed(false, net::ERR_ABORTED); | 672 OnRequestFailed(false, net::ERR_ABORTED); |
| 670 | 673 |
| 671 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 674 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 672 // destroyed the NavigationRequest. | 675 // destroyed the NavigationRequest. |
| 673 return; | 676 return; |
| 674 } | 677 } |
| 675 | 678 |
| 676 loader_->FollowRedirect(); | 679 loader_->FollowRedirect(); |
| 677 } | 680 } |
| 678 | 681 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 730 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 728 | 731 |
| 729 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 732 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 730 common_params_, request_params_, | 733 common_params_, request_params_, |
| 731 is_view_source_); | 734 is_view_source_); |
| 732 | 735 |
| 733 frame_tree_node_->ResetNavigationRequest(true); | 736 frame_tree_node_->ResetNavigationRequest(true); |
| 734 } | 737 } |
| 735 | 738 |
| 736 } // namespace content | 739 } // namespace content |
| OLD | NEW |