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 8904071971d98abe681d66e45323855444bb4f87..59c4d21f6fd95dfd86d893b91691707334b28246 100644 |
--- a/content/browser/frame_host/navigation_handle_impl.cc |
+++ b/content/browser/frame_host/navigation_handle_impl.cc |
@@ -21,7 +21,8 @@ namespace { |
void UpdateThrottleCheckResult( |
NavigationThrottle::ThrottleCheckResult* to_update, |
- NavigationThrottle::ThrottleCheckResult result) { |
+ NavigationThrottle::ThrottleCheckResult result, |
+ const NavigationHandleImpl::ExtraHeadersList& headers) { |
*to_update = result; |
} |
@@ -217,6 +218,15 @@ void NavigationHandleImpl::InitServiceWorkerHandle( |
new ServiceWorkerNavigationHandle(service_worker_context)); |
} |
+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()); |
davidben
2015/12/03 23:44:56
Perhaps also DCHECK on state_, in case you add a n
|
+ extra_headers_to_add_.push_back( |
+ std::pair<std::string, std::string>(name, value)); |
+} |
+ |
void NavigationHandleImpl::WillStartRequest( |
bool is_post, |
const Referrer& sanitized_referrer, |
@@ -376,9 +386,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 |