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

Unified Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 1416953007: Add a function to add extra headers from NavigationThrottle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data-reduction-proxy-resource-throttle
Patch Set: Rebase Created 5 years 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698