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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 704 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
703 result == NavigationThrottle::CANCEL) { | 705 result == NavigationThrottle::CANCEL) { |
704 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 706 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
705 OnRequestFailed(false, net::ERR_ABORTED); | 707 OnRequestFailed(false, net::ERR_ABORTED); |
706 | 708 |
707 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 709 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
708 // destroyed the NavigationRequest. | 710 // destroyed the NavigationRequest. |
709 return; | 711 return; |
710 } | 712 } |
711 | 713 |
| 714 if (result == NavigationThrottle::BLOCK_REQUEST) { |
| 715 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); |
| 716 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
| 717 // destroyed the NavigationRequest. |
| 718 return; |
| 719 } |
| 720 |
712 loader_->FollowRedirect(); | 721 loader_->FollowRedirect(); |
713 } | 722 } |
714 | 723 |
715 void NavigationRequest::OnWillProcessResponseChecksComplete( | 724 void NavigationRequest::OnWillProcessResponseChecksComplete( |
716 NavigationThrottle::ThrottleCheckResult result) { | 725 NavigationThrottle::ThrottleCheckResult result) { |
717 DCHECK(result != NavigationThrottle::DEFER); | 726 DCHECK(result != NavigationThrottle::DEFER); |
718 | 727 |
719 // Abort the request if needed. This includes requests that were blocked by | 728 // Abort the request if needed. This includes requests that were blocked by |
720 // NavigationThrottles and requests that should not commit (e.g. downloads, | 729 // NavigationThrottles and requests that should not commit (e.g. downloads, |
721 // 204/205s). This will destroy the NavigationRequest. | 730 // 204/205s). This will destroy the NavigationRequest. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 772 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
764 | 773 |
765 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 774 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
766 common_params_, request_params_, | 775 common_params_, request_params_, |
767 is_view_source_); | 776 is_view_source_); |
768 | 777 |
769 frame_tree_node_->ResetNavigationRequest(true); | 778 frame_tree_node_->ResetNavigationRequest(true); |
770 } | 779 } |
771 | 780 |
772 } // namespace content | 781 } // namespace content |
OLD | NEW |