Index: chrome/browser/extensions/api/web_request/web_request_api.cc |
diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc |
index cb7a821dcdbc4f0e811d3cef0c8df2d7af90fcd4..867acb25e53c90dd8fff5982ecd5f9a7c4db8f4a 100644 |
--- a/chrome/browser/extensions/api/web_request/web_request_api.cc |
+++ b/chrome/browser/extensions/api/web_request/web_request_api.cc |
@@ -495,7 +495,7 @@ struct ExtensionWebRequestEventRouter::BlockedRequest { |
net::CompletionCallback callback; |
// If non-empty, this contains the new URL that the request will redirect to. |
- // Only valid for OnBeforeRequest. |
+ // Only valid for OnBeforeRequest and OnHeadersReceived. |
GURL* new_url; |
// The request headers that will be issued along with this request. Only valid |
@@ -827,6 +827,7 @@ int ExtensionWebRequestEventRouter::OnHeadersReceived( |
InfoMap* extension_info_map, |
net::URLRequest* request, |
const net::CompletionCallback& callback, |
+ GURL* new_url, |
const net::HttpResponseHeaders* original_response_headers, |
scoped_refptr<net::HttpResponseHeaders>* override_response_headers) { |
// We hide events from the system context as well as sensitive requests. |
@@ -874,6 +875,7 @@ int ExtensionWebRequestEventRouter::OnHeadersReceived( |
blocked_requests_[request->identifier()].request = request; |
blocked_requests_[request->identifier()].callback = callback; |
blocked_requests_[request->identifier()].net_log = &request->net_log(); |
+ blocked_requests_[request->identifier()].new_url = new_url; |
blocked_requests_[request->identifier()].override_response_headers = |
override_response_headers; |
blocked_requests_[request->identifier()].original_response_headers = |
@@ -1555,7 +1557,7 @@ helpers::EventResponseDelta* CalculateDelta( |
response->response_headers.get(); |
return helpers::CalculateOnHeadersReceivedDelta( |
response->extension_id, response->extension_install_time, |
- response->cancel, old_headers, new_headers); |
+ response->cancel, response->new_url, old_headers, new_headers); |
} |
case ExtensionWebRequestEventRouter::kOnAuthRequired: |
return helpers::CalculateOnAuthRequiredDelta( |
@@ -1843,6 +1845,7 @@ int ExtensionWebRequestEventRouter::ExecuteDeltas( |
CHECK(!blocked_request.callback.is_null()); |
helpers::MergeOnHeadersReceivedResponses( |
blocked_request.response_deltas, |
+ blocked_request.new_url, |
blocked_request.original_response_headers.get(), |
blocked_request.override_response_headers, |
&warnings, |