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

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

Issue 2708923005: Extensions: Add metrics for Web Request API actions. (Closed)
Patch Set: Rename enum WebRequestAction -> RequestAction in histograms.xml to be in line with the implementation. Created 3 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 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 // Modifies the "Cookie" header in |request_headers| according to 274 // Modifies the "Cookie" header in |request_headers| according to
275 // |deltas.request_cookie_modifications|. Conflicts are currently ignored 275 // |deltas.request_cookie_modifications|. Conflicts are currently ignored
276 // silently. 276 // silently.
277 void MergeCookiesInOnBeforeSendHeadersResponses( 277 void MergeCookiesInOnBeforeSendHeadersResponses(
278 const EventResponseDeltas& deltas, 278 const EventResponseDeltas& deltas,
279 net::HttpRequestHeaders* request_headers, 279 net::HttpRequestHeaders* request_headers,
280 extensions::WarningSet* conflicting_extensions, 280 extensions::WarningSet* conflicting_extensions,
281 const net::NetLogWithSource* net_log); 281 const net::NetLogWithSource* net_log);
282 // Modifies the headers in |request_headers| according to |deltas|. Conflicts 282 // Modifies the headers in |request_headers| according to |deltas|. Conflicts
283 // are tried to be resolved. 283 // are tried to be resolved.
284 // Stores in |request_headers_modified| whether the request headers were
285 // modified.
284 void MergeOnBeforeSendHeadersResponses( 286 void MergeOnBeforeSendHeadersResponses(
285 const EventResponseDeltas& deltas, 287 const EventResponseDeltas& deltas,
286 net::HttpRequestHeaders* request_headers, 288 net::HttpRequestHeaders* request_headers,
287 extensions::WarningSet* conflicting_extensions, 289 extensions::WarningSet* conflicting_extensions,
288 const net::NetLogWithSource* net_log); 290 const net::NetLogWithSource* net_log,
291 bool* request_headers_modified);
289 // Modifies the "Set-Cookie" headers in |override_response_headers| according to 292 // Modifies the "Set-Cookie" headers in |override_response_headers| according to
290 // |deltas.response_cookie_modifications|. If |override_response_headers| is 293 // |deltas.response_cookie_modifications|. If |override_response_headers| is
291 // NULL, a copy of |original_response_headers| is created. Conflicts are 294 // NULL, a copy of |original_response_headers| is created. Conflicts are
292 // currently ignored silently. 295 // currently ignored silently.
293 void MergeCookiesInOnHeadersReceivedResponses( 296 void MergeCookiesInOnHeadersReceivedResponses(
294 const EventResponseDeltas& deltas, 297 const EventResponseDeltas& deltas,
295 const net::HttpResponseHeaders* original_response_headers, 298 const net::HttpResponseHeaders* original_response_headers,
296 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 299 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
297 extensions::WarningSet* conflicting_extensions, 300 extensions::WarningSet* conflicting_extensions,
298 const net::NetLogWithSource* net_log); 301 const net::NetLogWithSource* net_log);
299 // Stores a copy of |original_response_header| into |override_response_headers| 302 // Stores a copy of |original_response_header| into |override_response_headers|
300 // that is modified according to |deltas|. If |deltas| does not instruct to 303 // that is modified according to |deltas|. If |deltas| does not instruct to
301 // modify the response headers, |override_response_headers| remains empty. 304 // modify the response headers, |override_response_headers| remains empty.
302 // Extension-initiated redirects are written to |override_response_headers| 305 // Extension-initiated redirects are written to |override_response_headers|
303 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure 306 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure
304 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT). 307 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT).
308 // Stores in |response_headers_modified| whether the response headers were
309 // modified.
305 void MergeOnHeadersReceivedResponses( 310 void MergeOnHeadersReceivedResponses(
306 const GURL& url, 311 const GURL& url,
307 const EventResponseDeltas& deltas, 312 const EventResponseDeltas& deltas,
308 const net::HttpResponseHeaders* original_response_headers, 313 const net::HttpResponseHeaders* original_response_headers,
309 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 314 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
310 GURL* allowed_unsafe_redirect_url, 315 GURL* allowed_unsafe_redirect_url,
311 extensions::WarningSet* conflicting_extensions, 316 extensions::WarningSet* conflicting_extensions,
312 const net::NetLogWithSource* net_log); 317 const net::NetLogWithSource* net_log,
318 bool* response_headers_modified);
313 // Merge the responses of blocked onAuthRequired handlers. The first 319 // Merge the responses of blocked onAuthRequired handlers. The first
314 // registered listener that supplies authentication credentials in a response, 320 // registered listener that supplies authentication credentials in a response,
315 // if any, will have its authentication credentials used. |request| must be 321 // if any, will have its authentication credentials used. |request| must be
316 // non-NULL, and contain |deltas| that are sorted in decreasing order of 322 // non-NULL, and contain |deltas| that are sorted in decreasing order of
317 // precedence. 323 // precedence.
318 // Returns whether authentication credentials are set. 324 // Returns whether authentication credentials are set.
319 bool MergeOnAuthRequiredResponses( 325 bool MergeOnAuthRequiredResponses(
320 const EventResponseDeltas& deltas, 326 const EventResponseDeltas& deltas,
321 net::AuthCredentials* auth_credentials, 327 net::AuthCredentials* auth_credentials,
322 extensions::WarningSet* conflicting_extensions, 328 extensions::WarningSet* conflicting_extensions,
323 const net::NetLogWithSource* net_log); 329 const net::NetLogWithSource* net_log);
324 330
325 // Triggers clearing each renderer's in-memory cache the next time it navigates. 331 // Triggers clearing each renderer's in-memory cache the next time it navigates.
326 void ClearCacheOnNavigation(); 332 void ClearCacheOnNavigation();
327 333
328 // Converts the |name|, |value| pair of a http header to a HttpHeaders 334 // Converts the |name|, |value| pair of a http header to a HttpHeaders
329 // dictionary. 335 // dictionary.
330 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary( 336 std::unique_ptr<base::DictionaryValue> CreateHeaderDictionary(
331 const std::string& name, 337 const std::string& name,
332 const std::string& value); 338 const std::string& value);
333 339
334 } // namespace extension_web_request_api_helpers 340 } // namespace extension_web_request_api_helpers
335 341
336 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 342 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/web_request/web_request_api.cc ('k') | extensions/browser/api/web_request/web_request_api_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698