Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: content/browser/frame_host/navigation_request.cc

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Rebase. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (!begin_params_.client_side_redirect_url.is_empty()) 386 if (!begin_params_.client_side_redirect_url.is_empty())
387 redirect_chain.push_back(begin_params_.client_side_redirect_url); 387 redirect_chain.push_back(begin_params_.client_side_redirect_url);
388 redirect_chain.push_back(common_params_.url); 388 redirect_chain.push_back(common_params_.url);
389 389
390 std::unique_ptr<NavigationHandleImpl> navigation_handle = 390 std::unique_ptr<NavigationHandleImpl> navigation_handle =
391 NavigationHandleImpl::Create( 391 NavigationHandleImpl::Create(
392 common_params_.url, redirect_chain, frame_tree_node_, 392 common_params_.url, redirect_chain, frame_tree_node_,
393 !browser_initiated_, FrameMsg_Navigate_Type::IsSameDocument( 393 !browser_initiated_, FrameMsg_Navigate_Type::IsSameDocument(
394 common_params_.navigation_type), 394 common_params_.navigation_type),
395 common_params_.navigation_start, pending_nav_entry_id, 395 common_params_.navigation_start, pending_nav_entry_id,
396 false); // started_in_context_menu 396 false, // started_in_context_menu
397 common_params_.should_bypass_main_world_csp);
397 398
398 if (!frame_tree_node->navigation_request()) { 399 if (!frame_tree_node->navigation_request()) {
399 // A callback could have cancelled this request synchronously in which case 400 // A callback could have cancelled this request synchronously in which case
400 // |this| is deleted. 401 // |this| is deleted.
401 return; 402 return;
402 } 403 }
403 404
404 navigation_handle_ = std::move(navigation_handle); 405 navigation_handle_ = std::move(navigation_handle);
405 406
406 if (!begin_params_.searchable_form_url.is_empty()) { 407 if (!begin_params_.searchable_form_url.is_empty()) {
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 if (result == NavigationThrottle::CANCEL_AND_IGNORE || 677 if (result == NavigationThrottle::CANCEL_AND_IGNORE ||
677 result == NavigationThrottle::CANCEL) { 678 result == NavigationThrottle::CANCEL) {
678 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. 679 // TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE.
679 OnRequestFailed(false, net::ERR_ABORTED); 680 OnRequestFailed(false, net::ERR_ABORTED);
680 681
681 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has 682 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
682 // destroyed the NavigationRequest. 683 // destroyed the NavigationRequest.
683 return; 684 return;
684 } 685 }
685 686
687 if (result == NavigationThrottle::BLOCK_REQUEST) {
688 OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT);
689 // DO NOT ADD CODE after this. The previous call to OnRequestFailed has
690 // destroyed the NavigationRequest.
691 return;
692 }
693
686 loader_->FollowRedirect(); 694 loader_->FollowRedirect();
687 } 695 }
688 696
689 void NavigationRequest::OnWillProcessResponseChecksComplete( 697 void NavigationRequest::OnWillProcessResponseChecksComplete(
690 NavigationThrottle::ThrottleCheckResult result) { 698 NavigationThrottle::ThrottleCheckResult result) {
691 DCHECK(result != NavigationThrottle::DEFER); 699 DCHECK(result != NavigationThrottle::DEFER);
692 700
693 // Abort the request if needed. This includes requests that were blocked by 701 // Abort the request if needed. This includes requests that were blocked by
694 // NavigationThrottles and requests that should not commit (e.g. downloads, 702 // NavigationThrottles and requests that should not commit (e.g. downloads,
695 // 204/205s). This will destroy the NavigationRequest. 703 // 204/205s). This will destroy the NavigationRequest.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 745 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
738 746
739 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 747 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
740 common_params_, request_params_, 748 common_params_, request_params_,
741 is_view_source_); 749 is_view_source_);
742 750
743 frame_tree_node_->ResetNavigationRequest(true); 751 frame_tree_node_->ResetNavigationRequest(true);
744 } 752 }
745 753
746 } // namespace content 754 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698