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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 if (!begin_params_.client_side_redirect_url.is_empty()) | 397 if (!begin_params_.client_side_redirect_url.is_empty()) |
398 redirect_chain.push_back(begin_params_.client_side_redirect_url); | 398 redirect_chain.push_back(begin_params_.client_side_redirect_url); |
399 redirect_chain.push_back(common_params_.url); | 399 redirect_chain.push_back(common_params_.url); |
400 | 400 |
401 std::unique_ptr<NavigationHandleImpl> navigation_handle = | 401 std::unique_ptr<NavigationHandleImpl> navigation_handle = |
402 NavigationHandleImpl::Create( | 402 NavigationHandleImpl::Create( |
403 common_params_.url, redirect_chain, frame_tree_node_, | 403 common_params_.url, redirect_chain, frame_tree_node_, |
404 !browser_initiated_, FrameMsg_Navigate_Type::IsSameDocument( | 404 !browser_initiated_, FrameMsg_Navigate_Type::IsSameDocument( |
405 common_params_.navigation_type), | 405 common_params_.navigation_type), |
406 common_params_.navigation_start, pending_nav_entry_id, | 406 common_params_.navigation_start, pending_nav_entry_id, |
407 false); // started_in_context_menu | 407 false, // started_in_context_menu |
408 common_params_.should_bypass_main_world_csp); | |
408 | 409 |
409 if (!frame_tree_node->navigation_request()) { | 410 if (!frame_tree_node->navigation_request()) { |
410 // A callback could have cancelled this request synchronously in which case | 411 // A callback could have cancelled this request synchronously in which case |
411 // |this| is deleted. | 412 // |this| is deleted. |
412 return; | 413 return; |
413 } | 414 } |
414 | 415 |
415 navigation_handle_ = std::move(navigation_handle); | 416 navigation_handle_ = std::move(navigation_handle); |
416 | 417 |
417 if (!begin_params_.searchable_form_url.is_empty()) { | 418 if (!begin_params_.searchable_form_url.is_empty()) { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 if (result == NavigationThrottle::CANCEL_AND_IGNORE || | 687 if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
687 result == NavigationThrottle::CANCEL) { | 688 result == NavigationThrottle::CANCEL) { |
688 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. | 689 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
689 OnRequestFailed(false, net::ERR_ABORTED); | 690 OnRequestFailed(false, net::ERR_ABORTED); |
690 | 691 |
691 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | 692 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
692 // destroyed the NavigationRequest. | 693 // destroyed the NavigationRequest. |
693 return; | 694 return; |
694 } | 695 } |
695 | 696 |
697 if (result == NavigationThrottle::BLOCK_REQUEST) { | |
698 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); | |
699 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has | |
700 // destroyed the NavigationRequest. | |
701 return; | |
702 } | |
nasko
2017/02/15 21:28:44
I think this code along with the necessary changes
arthursonzogni
2017/02/16 17:32:41
Acknowledged. Please see:
https://codereview.chrom
| |
703 | |
696 loader_->FollowRedirect(); | 704 loader_->FollowRedirect(); |
697 } | 705 } |
698 | 706 |
699 void NavigationRequest::OnWillProcessResponseChecksComplete( | 707 void NavigationRequest::OnWillProcessResponseChecksComplete( |
700 NavigationThrottle::ThrottleCheckResult result) { | 708 NavigationThrottle::ThrottleCheckResult result) { |
701 DCHECK(result != NavigationThrottle::DEFER); | 709 DCHECK(result != NavigationThrottle::DEFER); |
702 | 710 |
703 // Abort the request if needed. This includes requests that were blocked by | 711 // Abort the request if needed. This includes requests that were blocked by |
704 // NavigationThrottles and requests that should not commit (e.g. downloads, | 712 // NavigationThrottles and requests that should not commit (e.g. downloads, |
705 // 204/205s). This will destroy the NavigationRequest. | 713 // 204/205s). This will destroy the NavigationRequest. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 755 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
748 | 756 |
749 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 757 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
750 common_params_, request_params_, | 758 common_params_, request_params_, |
751 is_view_source_); | 759 is_view_source_); |
752 | 760 |
753 frame_tree_node_->ResetNavigationRequest(true); | 761 frame_tree_node_->ResetNavigationRequest(true); |
754 } | 762 } |
755 | 763 |
756 } // namespace content | 764 } // namespace content |
OLD | NEW |