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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 void NavigationRequest::CreateNavigationHandle(int pending_nav_entry_id) { | 382 void NavigationRequest::CreateNavigationHandle(int pending_nav_entry_id) { |
383 DCHECK_EQ(frame_tree_node_->navigation_request(), this); | 383 DCHECK_EQ(frame_tree_node_->navigation_request(), this); |
384 FrameTreeNode* frame_tree_node = frame_tree_node_; | 384 FrameTreeNode* frame_tree_node = frame_tree_node_; |
385 | 385 |
386 std::vector<GURL> redirect_chain; | 386 std::vector<GURL> redirect_chain; |
387 if (!begin_params_.client_side_redirect_url.is_empty()) | 387 if (!begin_params_.client_side_redirect_url.is_empty()) |
388 redirect_chain.push_back(begin_params_.client_side_redirect_url); | 388 redirect_chain.push_back(begin_params_.client_side_redirect_url); |
389 redirect_chain.push_back(common_params_.url); | 389 redirect_chain.push_back(common_params_.url); |
390 | 390 |
391 std::unique_ptr<NavigationHandleImpl> navigation_handle = | 391 std::unique_ptr<NavigationHandleImpl> navigation_handle = |
392 NavigationHandleImpl::Create( | 392 NavigationHandleImpl::Create(common_params_.url, redirect_chain, |
393 common_params_.url, redirect_chain, frame_tree_node_, | 393 frame_tree_node_, !browser_initiated_, |
394 !browser_initiated_, FrameMsg_Navigate_Type::IsSameDocument( | 394 FrameMsg_Navigate_Type::IsSameDocument( |
395 common_params_.navigation_type), | 395 common_params_.navigation_type), |
396 common_params_.navigation_start, pending_nav_entry_id, | 396 common_params_.navigation_start, |
397 false); // started_in_context_menu | 397 pending_nav_entry_id, |
| 398 false, // started_in_context_menu |
| 399 common_params_.should_bypass_main_world_csp); |
398 | 400 |
399 if (!frame_tree_node->navigation_request()) { | 401 if (!frame_tree_node->navigation_request()) { |
400 // A callback could have cancelled this request synchronously in which case | 402 // A callback could have cancelled this request synchronously in which case |
401 // |this| is deleted. | 403 // |this| is deleted. |
402 return; | 404 return; |
403 } | 405 } |
404 | 406 |
405 navigation_handle_ = std::move(navigation_handle); | 407 navigation_handle_ = std::move(navigation_handle); |
406 | 408 |
407 if (!begin_params_.searchable_form_url.is_empty()) { | 409 if (!begin_params_.searchable_form_url.is_empty()) { |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 710 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
709 result == NavigationThrottle::CANCEL) { | 711 result == NavigationThrottle::CANCEL) { |
710 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 712 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
711 OnRequestFailed(false, net::ERR_ABORTED); | 713 OnRequestFailed(false, net::ERR_ABORTED); |
712 | 714 |
713 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 715 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
714 // destroyed the NavigationRequest. | 716 // destroyed the NavigationRequest. |
715 return; | 717 return; |
716 } | 718 } |
717 | 719 |
| 720 if (result == NavigationThrottle::BLOCK_REQUEST) { |
| 721 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); |
| 722 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 723 // destroyed the NavigationRequest. |
| 724 return; |
| 725 } |
| 726 |
718 loader_->FollowRedirect(); | 727 loader_->FollowRedirect(); |
719 } | 728 } |
720 | 729 |
721 void NavigationRequest::OnWillProcessResponseChecksComplete( | 730 void NavigationRequest::OnWillProcessResponseChecksComplete( |
722 NavigationThrottle::ThrottleCheckResult result) { | 731 NavigationThrottle::ThrottleCheckResult result) { |
723 DCHECK(result != NavigationThrottle::DEFER); | 732 DCHECK(result != NavigationThrottle::DEFER); |
724 | 733 |
725 // Abort the request if needed. This includes requests that were blocked by | 734 // Abort the request if needed. This includes requests that were blocked by |
726 // NavigationThrottles and requests that should not commit (e.g. downloads, | 735 // NavigationThrottles and requests that should not commit (e.g. downloads, |
727 // 204/205s). This will destroy the NavigationRequest. | 736 // 204/205s). This will destroy the NavigationRequest. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 778 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
770 | 779 |
771 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 780 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
772 common_params_, request_params_, | 781 common_params_, request_params_, |
773 is_view_source_); | 782 is_view_source_); |
774 | 783 |
775 frame_tree_node_->ResetNavigationRequest(true); | 784 frame_tree_node_->ResetNavigationRequest(true); |
776 } | 785 } |
777 | 786 |
778 } // namespace content | 787 } // namespace content |
OLD | NEW |