Index: content/browser/frame_host/navigation_request.cc |
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc |
index 0fa8adf29875200f0874ae8ff90e031f309a41ae..a1e067f69abba2a233089877340ece84226efea1 100644 |
--- a/content/browser/frame_host/navigation_request.cc |
+++ b/content/browser/frame_host/navigation_request.cc |
@@ -7,7 +7,6 @@ |
#include "content/browser/frame_host/frame_tree.h" |
#include "content/browser/frame_host/frame_tree_node.h" |
#include "content/browser/frame_host/navigation_controller_impl.h" |
-#include "content/browser/frame_host/navigation_handle_impl.h" |
#include "content/browser/frame_host/navigation_request_info.h" |
#include "content/browser/frame_host/navigator.h" |
#include "content/browser/loader/navigation_url_loader.h" |
@@ -284,7 +283,8 @@ void NavigationRequest::OnRequestStarted(base::TimeTicks timestamp) { |
} |
void NavigationRequest::OnStartChecksComplete( |
- NavigationThrottle::ThrottleCheckResult result) { |
+ NavigationThrottle::ThrottleCheckResult result, |
+ const NavigationHandleImpl::ExtraHeadersList& extra_headers_list) { |
CHECK(result != NavigationThrottle::DEFER); |
// Abort the request if needed. This will destroy the NavigationRequest. |
@@ -295,13 +295,22 @@ void NavigationRequest::OnStartChecksComplete( |
return; |
} |
+ // Add extra headers to the request before sending it to the network stack. |
+ net::HttpRequestHeaders headers; |
+ headers.AddHeadersFromString(begin_params_.headers); |
+ for (const auto& header : extra_headers_list) |
+ headers.SetHeader(header.first, header.second); |
+ begin_params_.headers = headers.ToString(); |
+ info_->begin_params.headers = headers.ToString(); |
+ |
loader_ = NavigationURLLoader::Create( |
frame_tree_node_->navigator()->GetController()->GetBrowserContext(), |
info_.Pass(), navigation_handle_->service_worker_handle(), this); |
} |
void NavigationRequest::OnRedirectChecksComplete( |
- NavigationThrottle::ThrottleCheckResult result) { |
+ NavigationThrottle::ThrottleCheckResult result, |
+ const NavigationHandleImpl::ExtraHeadersList& extra_headers_list) { |
CHECK(result != NavigationThrottle::DEFER); |
// Abort the request if needed. This will destroy the NavigationRequest. |
@@ -312,7 +321,7 @@ void NavigationRequest::OnRedirectChecksComplete( |
return; |
} |
- loader_->FollowRedirect(); |
+ loader_->FollowRedirect(extra_headers_list); |
navigation_handle_->DidRedirectNavigation(common_params_.url); |
} |