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

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

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 years, 2 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 EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 7 #ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
8 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 8 #define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
9 9
10 #include <list> 10 #include <list>
(...skipping 19 matching lines...) Expand all
30 30
31 namespace content { 31 namespace content {
32 class RenderProcessHost; 32 class RenderProcessHost;
33 } 33 }
34 34
35 namespace extensions { 35 namespace extensions {
36 class Extension; 36 class Extension;
37 } 37 }
38 38
39 namespace net { 39 namespace net {
40 class BoundNetLog; 40 class NetLogWithSource;
41 class URLRequest; 41 class URLRequest;
42 } 42 }
43 43
44 namespace extension_web_request_api_helpers { 44 namespace extension_web_request_api_helpers {
45 45
46 typedef std::pair<std::string, std::string> ResponseHeader; 46 typedef std::pair<std::string, std::string> ResponseHeader;
47 typedef std::vector<ResponseHeader> ResponseHeaders; 47 typedef std::vector<ResponseHeader> ResponseHeaders;
48 48
49 // Internal representation of the extraInfoSpec parameter on webRequest 49 // Internal representation of the extraInfoSpec parameter on webRequest
50 // events, used to specify extra information to be included with network 50 // events, used to specify extra information to be included with network
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 bool cancel, 250 bool cancel,
251 std::unique_ptr<net::AuthCredentials>* auth_credentials); 251 std::unique_ptr<net::AuthCredentials>* auth_credentials);
252 252
253 // These functions merge the responses (the |deltas|) of request handlers. 253 // These functions merge the responses (the |deltas|) of request handlers.
254 // The |deltas| need to be sorted in decreasing order of precedence of 254 // The |deltas| need to be sorted in decreasing order of precedence of
255 // extensions. In case extensions had |deltas| that could not be honored, their 255 // extensions. In case extensions had |deltas| that could not be honored, their
256 // IDs are reported in |conflicting_extensions|. NetLog events that shall be 256 // IDs are reported in |conflicting_extensions|. NetLog events that shall be
257 // reported will be stored in |event_log_entries|. 257 // reported will be stored in |event_log_entries|.
258 258
259 // Stores in |canceled| whether any extension wanted to cancel the request. 259 // Stores in |canceled| whether any extension wanted to cancel the request.
260 void MergeCancelOfResponses( 260 void MergeCancelOfResponses(const EventResponseDeltas& deltas,
261 const EventResponseDeltas& deltas, 261 bool* canceled,
262 bool* canceled, 262 const net::NetLogWithSource* net_log);
263 const net::BoundNetLog* net_log);
264 // Stores in |*new_url| the redirect request of the extension with highest 263 // Stores in |*new_url| the redirect request of the extension with highest
265 // precedence. Extensions that did not command to redirect the request are 264 // precedence. Extensions that did not command to redirect the request are
266 // ignored in this logic. 265 // ignored in this logic.
267 void MergeRedirectUrlOfResponses( 266 void MergeRedirectUrlOfResponses(const EventResponseDeltas& deltas,
268 const EventResponseDeltas& deltas, 267 GURL* new_url,
269 GURL* new_url, 268 extensions::WarningSet* conflicting_extensions,
270 extensions::WarningSet* conflicting_extensions, 269 const net::NetLogWithSource* net_log);
271 const net::BoundNetLog* net_log);
272 // Stores in |*new_url| the redirect request of the extension with highest 270 // Stores in |*new_url| the redirect request of the extension with highest
273 // precedence. Extensions that did not command to redirect the request are 271 // precedence. Extensions that did not command to redirect the request are
274 // ignored in this logic. 272 // ignored in this logic.
275 void MergeOnBeforeRequestResponses( 273 void MergeOnBeforeRequestResponses(
276 const EventResponseDeltas& deltas, 274 const EventResponseDeltas& deltas,
277 GURL* new_url, 275 GURL* new_url,
278 extensions::WarningSet* conflicting_extensions, 276 extensions::WarningSet* conflicting_extensions,
279 const net::BoundNetLog* net_log); 277 const net::NetLogWithSource* net_log);
280 // Modifies the "Cookie" header in |request_headers| according to 278 // Modifies the "Cookie" header in |request_headers| according to
281 // |deltas.request_cookie_modifications|. Conflicts are currently ignored 279 // |deltas.request_cookie_modifications|. Conflicts are currently ignored
282 // silently. 280 // silently.
283 void MergeCookiesInOnBeforeSendHeadersResponses( 281 void MergeCookiesInOnBeforeSendHeadersResponses(
284 const EventResponseDeltas& deltas, 282 const EventResponseDeltas& deltas,
285 net::HttpRequestHeaders* request_headers, 283 net::HttpRequestHeaders* request_headers,
286 extensions::WarningSet* conflicting_extensions, 284 extensions::WarningSet* conflicting_extensions,
287 const net::BoundNetLog* net_log); 285 const net::NetLogWithSource* net_log);
288 // Modifies the headers in |request_headers| according to |deltas|. Conflicts 286 // Modifies the headers in |request_headers| according to |deltas|. Conflicts
289 // are tried to be resolved. 287 // are tried to be resolved.
290 void MergeOnBeforeSendHeadersResponses( 288 void MergeOnBeforeSendHeadersResponses(
291 const EventResponseDeltas& deltas, 289 const EventResponseDeltas& deltas,
292 net::HttpRequestHeaders* request_headers, 290 net::HttpRequestHeaders* request_headers,
293 extensions::WarningSet* conflicting_extensions, 291 extensions::WarningSet* conflicting_extensions,
294 const net::BoundNetLog* net_log); 292 const net::NetLogWithSource* net_log);
295 // Modifies the "Set-Cookie" headers in |override_response_headers| according to 293 // Modifies the "Set-Cookie" headers in |override_response_headers| according to
296 // |deltas.response_cookie_modifications|. If |override_response_headers| is 294 // |deltas.response_cookie_modifications|. If |override_response_headers| is
297 // NULL, a copy of |original_response_headers| is created. Conflicts are 295 // NULL, a copy of |original_response_headers| is created. Conflicts are
298 // currently ignored silently. 296 // currently ignored silently.
299 void MergeCookiesInOnHeadersReceivedResponses( 297 void MergeCookiesInOnHeadersReceivedResponses(
300 const EventResponseDeltas& deltas, 298 const EventResponseDeltas& deltas,
301 const net::HttpResponseHeaders* original_response_headers, 299 const net::HttpResponseHeaders* original_response_headers,
302 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 300 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
303 extensions::WarningSet* conflicting_extensions, 301 extensions::WarningSet* conflicting_extensions,
304 const net::BoundNetLog* net_log); 302 const net::NetLogWithSource* net_log);
305 // Stores a copy of |original_response_header| into |override_response_headers| 303 // Stores a copy of |original_response_header| into |override_response_headers|
306 // that is modified according to |deltas|. If |deltas| does not instruct to 304 // that is modified according to |deltas|. If |deltas| does not instruct to
307 // modify the response headers, |override_response_headers| remains empty. 305 // modify the response headers, |override_response_headers| remains empty.
308 // Extension-initiated redirects are written to |override_response_headers| 306 // Extension-initiated redirects are written to |override_response_headers|
309 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure 307 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure
310 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT). 308 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT).
311 void MergeOnHeadersReceivedResponses( 309 void MergeOnHeadersReceivedResponses(
312 const EventResponseDeltas& deltas, 310 const EventResponseDeltas& deltas,
313 const net::HttpResponseHeaders* original_response_headers, 311 const net::HttpResponseHeaders* original_response_headers,
314 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 312 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
315 GURL* allowed_unsafe_redirect_url, 313 GURL* allowed_unsafe_redirect_url,
316 extensions::WarningSet* conflicting_extensions, 314 extensions::WarningSet* conflicting_extensions,
317 const net::BoundNetLog* net_log); 315 const net::NetLogWithSource* net_log);
318 // Merge the responses of blocked onAuthRequired handlers. The first 316 // Merge the responses of blocked onAuthRequired handlers. The first
319 // registered listener that supplies authentication credentials in a response, 317 // registered listener that supplies authentication credentials in a response,
320 // if any, will have its authentication credentials used. |request| must be 318 // if any, will have its authentication credentials used. |request| must be
321 // non-NULL, and contain |deltas| that are sorted in decreasing order of 319 // non-NULL, and contain |deltas| that are sorted in decreasing order of
322 // precedence. 320 // precedence.
323 // Returns whether authentication credentials are set. 321 // Returns whether authentication credentials are set.
324 bool MergeOnAuthRequiredResponses( 322 bool MergeOnAuthRequiredResponses(
325 const EventResponseDeltas& deltas, 323 const EventResponseDeltas& deltas,
326 net::AuthCredentials* auth_credentials, 324 net::AuthCredentials* auth_credentials,
327 extensions::WarningSet* conflicting_extensions, 325 extensions::WarningSet* conflicting_extensions,
328 const net::BoundNetLog* net_log); 326 const net::NetLogWithSource* net_log);
329 327
330 // Triggers clearing each renderer's in-memory cache the next time it navigates. 328 // Triggers clearing each renderer's in-memory cache the next time it navigates.
331 void ClearCacheOnNavigation(); 329 void ClearCacheOnNavigation();
332 330
333 // Tells renderer processes that the web request or declarative web request 331 // Tells renderer processes that the web request or declarative web request
334 // API has been used by the extension with the given |extension_id| in the 332 // API has been used by the extension with the given |extension_id| in the
335 // given |browser_context_id| to collect UMA statistics on Page Load Times. 333 // given |browser_context_id| to collect UMA statistics on Page Load Times.
336 // Needs to be called on the UI thread. 334 // Needs to be called on the UI thread.
337 void NotifyWebRequestAPIUsed(void* browser_context_id, 335 void NotifyWebRequestAPIUsed(void* browser_context_id,
338 const std::string& extension_id); 336 const std::string& extension_id);
(...skipping 18 matching lines...) Expand all
357 355
358 // Stores a |content::ResourceType| representation in |types| if |type_str| is 356 // Stores a |content::ResourceType| representation in |types| if |type_str| is
359 // a resource type handled by the web request API. Returns true in case of 357 // a resource type handled by the web request API. Returns true in case of
360 // success. 358 // success.
361 bool ParseResourceType(const std::string& type_str, 359 bool ParseResourceType(const std::string& type_str,
362 std::vector<content::ResourceType>* types); 360 std::vector<content::ResourceType>* types);
363 361
364 } // namespace extension_web_request_api_helpers 362 } // namespace extension_web_request_api_helpers
365 363
366 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 364 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698