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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api_helpers.h

Issue 154473002: Support redirectUrl at onHeadersReceived in WebRequest / DWR API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add more tests Created 6 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Helper classes and functions used for the WebRequest API. 5 // Helper classes and functions used for the WebRequest API.
6 6
7 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 7 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
8 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 8 #define CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
9 9
10 #include <list> 10 #include <list>
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 EventResponseDelta* CalculateOnBeforeSendHeadersDelta( 207 EventResponseDelta* CalculateOnBeforeSendHeadersDelta(
208 const std::string& extension_id, 208 const std::string& extension_id,
209 const base::Time& extension_install_time, 209 const base::Time& extension_install_time,
210 bool cancel, 210 bool cancel,
211 net::HttpRequestHeaders* old_headers, 211 net::HttpRequestHeaders* old_headers,
212 net::HttpRequestHeaders* new_headers); 212 net::HttpRequestHeaders* new_headers);
213 EventResponseDelta* CalculateOnHeadersReceivedDelta( 213 EventResponseDelta* CalculateOnHeadersReceivedDelta(
214 const std::string& extension_id, 214 const std::string& extension_id,
215 const base::Time& extension_install_time, 215 const base::Time& extension_install_time,
216 bool cancel, 216 bool cancel,
217 const GURL& new_url,
217 const net::HttpResponseHeaders* old_response_headers, 218 const net::HttpResponseHeaders* old_response_headers,
218 ResponseHeaders* new_response_headers); 219 ResponseHeaders* new_response_headers);
219 // Destructively moves the auth credentials from |auth_credentials| to the 220 // Destructively moves the auth credentials from |auth_credentials| to the
220 // returned EventResponseDelta. 221 // returned EventResponseDelta.
221 EventResponseDelta* CalculateOnAuthRequiredDelta( 222 EventResponseDelta* CalculateOnAuthRequiredDelta(
222 const std::string& extension_id, 223 const std::string& extension_id,
223 const base::Time& extension_install_time, 224 const base::Time& extension_install_time,
224 bool cancel, 225 bool cancel,
225 scoped_ptr<net::AuthCredentials>* auth_credentials); 226 scoped_ptr<net::AuthCredentials>* auth_credentials);
226 227
227 // These functions merge the responses (the |deltas|) of request handlers. 228 // These functions merge the responses (the |deltas|) of request handlers.
228 // The |deltas| need to be sorted in decreasing order of precedence of 229 // The |deltas| need to be sorted in decreasing order of precedence of
229 // extensions. In case extensions had |deltas| that could not be honored, their 230 // extensions. In case extensions had |deltas| that could not be honored, their
230 // IDs are reported in |conflicting_extensions|. NetLog events that shall be 231 // IDs are reported in |conflicting_extensions|. NetLog events that shall be
231 // reported will be stored in |event_log_entries|. 232 // reported will be stored in |event_log_entries|.
232 233
233 // Stores in |canceled| whether any extension wanted to cancel the request. 234 // Stores in |canceled| whether any extension wanted to cancel the request.
234 void MergeCancelOfResponses( 235 void MergeCancelOfResponses(
235 const EventResponseDeltas& deltas, 236 const EventResponseDeltas& deltas,
236 bool* canceled, 237 bool* canceled,
237 const net::BoundNetLog* net_log); 238 const net::BoundNetLog* net_log);
238 // Stores in |*new_url| the redirect request of the extension with highest 239 // Stores in |*new_url| the redirect request of the extension with highest
239 // precedence. Extensions that did not command to redirect the request are 240 // precedence. Extensions that did not command to redirect the request are
240 // ignored in this logic. 241 // ignored in this logic.
242 void MergeRedirectUrlOfResponses(
243 const EventResponseDeltas& deltas,
244 GURL* new_url,
245 extensions::ExtensionWarningSet* conflicting_extensions,
246 const net::BoundNetLog* net_log);
247 // Stores in |*new_url| the redirect request of the extension with highest
248 // precedence. Extensions that did not command to redirect the request are
249 // ignored in this logic.
241 void MergeOnBeforeRequestResponses( 250 void MergeOnBeforeRequestResponses(
242 const EventResponseDeltas& deltas, 251 const EventResponseDeltas& deltas,
243 GURL* new_url, 252 GURL* new_url,
244 extensions::ExtensionWarningSet* conflicting_extensions, 253 extensions::ExtensionWarningSet* conflicting_extensions,
245 const net::BoundNetLog* net_log); 254 const net::BoundNetLog* net_log);
246 // Modifies the "Cookie" header in |request_headers| according to 255 // Modifies the "Cookie" header in |request_headers| according to
247 // |deltas.request_cookie_modifications|. Conflicts are currently ignored 256 // |deltas.request_cookie_modifications|. Conflicts are currently ignored
248 // silently. 257 // silently.
249 void MergeCookiesInOnBeforeSendHeadersResponses( 258 void MergeCookiesInOnBeforeSendHeadersResponses(
250 const EventResponseDeltas& deltas, 259 const EventResponseDeltas& deltas,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // Tells renderer processes that the web request or declarative web request 318 // Tells renderer processes that the web request or declarative web request
310 // API has been used by |extension| in profile |profile_id| to collect 319 // API has been used by |extension| in profile |profile_id| to collect
311 // UMA statistics on Page Load Times. Needs to be called on the UI thread. 320 // UMA statistics on Page Load Times. Needs to be called on the UI thread.
312 void NotifyWebRequestAPIUsed( 321 void NotifyWebRequestAPIUsed(
313 void* profile_id, 322 void* profile_id,
314 scoped_refptr<const extensions::Extension> extension); 323 scoped_refptr<const extensions::Extension> extension);
315 324
316 } // namespace extension_web_request_api_helpers 325 } // namespace extension_web_request_api_helpers
317 326
318 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 327 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698