Index: content/browser/frame_host/navigation_handle_impl.cc |
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc |
index ff96cba7b1330207420df98728a7691c52698633..82bfa87e0421da6382ed7ed53fd189f508e11632 100644 |
--- a/content/browser/frame_host/navigation_handle_impl.cc |
+++ b/content/browser/frame_host/navigation_handle_impl.cc |
@@ -24,7 +24,8 @@ namespace { |
void UpdateThrottleCheckResult( |
NavigationThrottle::ThrottleCheckResult* to_update, |
- NavigationThrottle::ThrottleCheckResult result) { |
+ NavigationThrottle::ThrottleCheckResult result, |
+ const NavigationHandleImpl::ExtraHeadersList& headers) { |
*to_update = result; |
} |
@@ -218,6 +219,15 @@ NavigationHandleImpl::CallWillRedirectRequestForTesting( |
return result; |
} |
+void NavigationHandleImpl::AddExtraHeader(const std::string& name, |
+ const std::string& value) { |
+ // Only set headers during throttle checks, when the handler of the request |
+ // will be able to add them to the network request. |
+ DCHECK(!complete_callback_.is_null()); |
+ extra_headers_to_add_.push_back( |
+ std::pair<std::string, std::string>(name, value)); |
+} |
+ |
void NavigationHandleImpl::WillStartRequest( |
bool is_post, |
const Referrer& sanitized_referrer, |
@@ -367,9 +377,10 @@ void NavigationHandleImpl::RunCompleteCallback( |
NavigationThrottle::ThrottleCheckResult result) { |
DCHECK(result != NavigationThrottle::DEFER); |
if (!complete_callback_.is_null()) |
- complete_callback_.Run(result); |
+ complete_callback_.Run(result, extra_headers_to_add_); |
complete_callback_.Reset(); |
+ extra_headers_to_add_.clear(); |
} |
} // namespace content |