| Index: content/browser/loader/navigation_resource_throttle.cc
|
| diff --git a/content/browser/loader/navigation_resource_throttle.cc b/content/browser/loader/navigation_resource_throttle.cc
|
| index 44fd0c131ff413fd0d90d0d4c07adae7dedc338b..c00d397faa242edece1dd9bcaee9d085531b57a9 100644
|
| --- a/content/browser/loader/navigation_resource_throttle.cc
|
| +++ b/content/browser/loader/navigation_resource_throttle.cc
|
| @@ -20,15 +20,19 @@
|
| namespace content {
|
|
|
| namespace {
|
| -typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)>
|
| +typedef base::Callback<void(
|
| + NavigationThrottle::ThrottleCheckResult,
|
| + const std::vector<std::pair<std::string, std::string>>&)>
|
| UIChecksPerformedCallback;
|
|
|
| -void SendCheckResultToIOThread(UIChecksPerformedCallback callback,
|
| - NavigationThrottle::ThrottleCheckResult result) {
|
| +void SendCheckResultToIOThread(
|
| + UIChecksPerformedCallback callback,
|
| + NavigationThrottle::ThrottleCheckResult result,
|
| + const NavigationHandleImpl::ExtraHeadersList& extra_headers) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| CHECK(result != NavigationThrottle::DEFER);
|
| BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
|
| - base::Bind(callback, result));
|
| + base::Bind(callback, result, extra_headers));
|
| }
|
|
|
| void CheckWillStartRequestOnUIThread(UIChecksPerformedCallback callback,
|
| @@ -43,14 +47,16 @@ void CheckWillStartRequestOnUIThread(UIChecksPerformedCallback callback,
|
| RenderFrameHostImpl* render_frame_host =
|
| RenderFrameHostImpl::FromID(render_process_id, render_frame_host_id);
|
| if (!render_frame_host) {
|
| - SendCheckResultToIOThread(callback, NavigationThrottle::PROCEED);
|
| + SendCheckResultToIOThread(callback, NavigationThrottle::PROCEED,
|
| + NavigationHandleImpl::ExtraHeadersList());
|
| return;
|
| }
|
|
|
| NavigationHandleImpl* navigation_handle =
|
| render_frame_host->navigation_handle();
|
| if (!navigation_handle) {
|
| - SendCheckResultToIOThread(callback, NavigationThrottle::PROCEED);
|
| + SendCheckResultToIOThread(callback, NavigationThrottle::PROCEED,
|
| + NavigationHandleImpl::ExtraHeadersList());
|
| return;
|
| }
|
|
|
| @@ -72,14 +78,16 @@ void CheckWillRedirectRequestOnUIThread(
|
| RenderFrameHostImpl* render_frame_host =
|
| RenderFrameHostImpl::FromID(render_process_id, render_frame_host_id);
|
| if (!render_frame_host) {
|
| - SendCheckResultToIOThread(callback, NavigationThrottle::PROCEED);
|
| + SendCheckResultToIOThread(callback, NavigationThrottle::PROCEED,
|
| + NavigationHandleImpl::ExtraHeadersList());
|
| return;
|
| }
|
|
|
| NavigationHandleImpl* navigation_handle =
|
| render_frame_host->navigation_handle();
|
| if (!navigation_handle) {
|
| - SendCheckResultToIOThread(callback, NavigationThrottle::PROCEED);
|
| + SendCheckResultToIOThread(callback, NavigationThrottle::PROCEED,
|
| + NavigationHandleImpl::ExtraHeadersList());
|
| return;
|
| }
|
|
|
| @@ -215,13 +223,18 @@ const char* NavigationResourceThrottle::GetNameForLogging() const {
|
| }
|
|
|
| void NavigationResourceThrottle::OnUIChecksPerformed(
|
| - NavigationThrottle::ThrottleCheckResult result) {
|
| + NavigationThrottle::ThrottleCheckResult result,
|
| + const std::vector<std::pair<std::string, std::string>>& extra_headers) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| if (result == NavigationThrottle::CANCEL_AND_IGNORE) {
|
| controller()->CancelAndIgnore();
|
| } else if (result == NavigationThrottle::CANCEL) {
|
| controller()->Cancel();
|
| } else {
|
| + DCHECK(result == NavigationThrottle::PROCEED);
|
| + for (auto header : extra_headers) {
|
| + request_->SetExtraRequestHeaderByName(header.first, header.second, true);
|
| + }
|
| controller()->Resume();
|
| }
|
| }
|
|
|