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

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

Issue 503033002: Move ExtensionWarningService and ExtensionsWarningSet to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@3_web_view_internal
Patch Set: Rename. Created 6 years, 3 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>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 13
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/extensions/extension_warning_set.h"
19 #include "content/public/common/resource_type.h" 18 #include "content/public/common/resource_type.h"
19 #include "extensions/browser/warning_set.h"
20 #include "net/base/auth.h" 20 #include "net/base/auth.h"
21 #include "net/http/http_request_headers.h" 21 #include "net/http/http_request_headers.h"
22 #include "net/http/http_response_headers.h" 22 #include "net/http/http_response_headers.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 namespace base { 25 namespace base {
26 class ListValue; 26 class ListValue;
27 class Value; 27 class Value;
28 } 28 }
29 29
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void MergeCancelOfResponses( 235 void MergeCancelOfResponses(
236 const EventResponseDeltas& deltas, 236 const EventResponseDeltas& deltas,
237 bool* canceled, 237 bool* canceled,
238 const net::BoundNetLog* net_log); 238 const net::BoundNetLog* net_log);
239 // 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
240 // precedence. Extensions that did not command to redirect the request are 240 // precedence. Extensions that did not command to redirect the request are
241 // ignored in this logic. 241 // ignored in this logic.
242 void MergeRedirectUrlOfResponses( 242 void MergeRedirectUrlOfResponses(
243 const EventResponseDeltas& deltas, 243 const EventResponseDeltas& deltas,
244 GURL* new_url, 244 GURL* new_url,
245 extensions::ExtensionWarningSet* conflicting_extensions, 245 extensions::WarningSet* conflicting_extensions,
246 const net::BoundNetLog* net_log); 246 const net::BoundNetLog* net_log);
247 // Stores in |*new_url| the redirect request of the extension with highest 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 248 // precedence. Extensions that did not command to redirect the request are
249 // ignored in this logic. 249 // ignored in this logic.
250 void MergeOnBeforeRequestResponses( 250 void MergeOnBeforeRequestResponses(
251 const EventResponseDeltas& deltas, 251 const EventResponseDeltas& deltas,
252 GURL* new_url, 252 GURL* new_url,
253 extensions::ExtensionWarningSet* conflicting_extensions, 253 extensions::WarningSet* conflicting_extensions,
254 const net::BoundNetLog* net_log); 254 const net::BoundNetLog* net_log);
255 // Modifies the "Cookie" header in |request_headers| according to 255 // Modifies the "Cookie" header in |request_headers| according to
256 // |deltas.request_cookie_modifications|. Conflicts are currently ignored 256 // |deltas.request_cookie_modifications|. Conflicts are currently ignored
257 // silently. 257 // silently.
258 void MergeCookiesInOnBeforeSendHeadersResponses( 258 void MergeCookiesInOnBeforeSendHeadersResponses(
259 const EventResponseDeltas& deltas, 259 const EventResponseDeltas& deltas,
260 net::HttpRequestHeaders* request_headers, 260 net::HttpRequestHeaders* request_headers,
261 extensions::ExtensionWarningSet* conflicting_extensions, 261 extensions::WarningSet* conflicting_extensions,
262 const net::BoundNetLog* net_log); 262 const net::BoundNetLog* net_log);
263 // Modifies the headers in |request_headers| according to |deltas|. Conflicts 263 // Modifies the headers in |request_headers| according to |deltas|. Conflicts
264 // are tried to be resolved. 264 // are tried to be resolved.
265 void MergeOnBeforeSendHeadersResponses( 265 void MergeOnBeforeSendHeadersResponses(
266 const EventResponseDeltas& deltas, 266 const EventResponseDeltas& deltas,
267 net::HttpRequestHeaders* request_headers, 267 net::HttpRequestHeaders* request_headers,
268 extensions::ExtensionWarningSet* conflicting_extensions, 268 extensions::WarningSet* conflicting_extensions,
269 const net::BoundNetLog* net_log); 269 const net::BoundNetLog* net_log);
270 // Modifies the "Set-Cookie" headers in |override_response_headers| according to 270 // Modifies the "Set-Cookie" headers in |override_response_headers| according to
271 // |deltas.response_cookie_modifications|. If |override_response_headers| is 271 // |deltas.response_cookie_modifications|. If |override_response_headers| is
272 // NULL, a copy of |original_response_headers| is created. Conflicts are 272 // NULL, a copy of |original_response_headers| is created. Conflicts are
273 // currently ignored silently. 273 // currently ignored silently.
274 void MergeCookiesInOnHeadersReceivedResponses( 274 void MergeCookiesInOnHeadersReceivedResponses(
275 const EventResponseDeltas& deltas, 275 const EventResponseDeltas& deltas,
276 const net::HttpResponseHeaders* original_response_headers, 276 const net::HttpResponseHeaders* original_response_headers,
277 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 277 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
278 extensions::ExtensionWarningSet* conflicting_extensions, 278 extensions::WarningSet* conflicting_extensions,
279 const net::BoundNetLog* net_log); 279 const net::BoundNetLog* net_log);
280 // Stores a copy of |original_response_header| into |override_response_headers| 280 // Stores a copy of |original_response_header| into |override_response_headers|
281 // that is modified according to |deltas|. If |deltas| does not instruct to 281 // that is modified according to |deltas|. If |deltas| does not instruct to
282 // modify the response headers, |override_response_headers| remains empty. 282 // modify the response headers, |override_response_headers| remains empty.
283 // Extension-initiated redirects are written to |override_response_headers| 283 // Extension-initiated redirects are written to |override_response_headers|
284 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure 284 // (to request redirection) and |*allowed_unsafe_redirect_url| (to make sure
285 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT). 285 // that the request is not cancelled with net::ERR_UNSAFE_REDIRECT).
286 void MergeOnHeadersReceivedResponses( 286 void MergeOnHeadersReceivedResponses(
287 const EventResponseDeltas& deltas, 287 const EventResponseDeltas& deltas,
288 const net::HttpResponseHeaders* original_response_headers, 288 const net::HttpResponseHeaders* original_response_headers,
289 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, 289 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
290 GURL* allowed_unsafe_redirect_url, 290 GURL* allowed_unsafe_redirect_url,
291 extensions::ExtensionWarningSet* conflicting_extensions, 291 extensions::WarningSet* conflicting_extensions,
292 const net::BoundNetLog* net_log); 292 const net::BoundNetLog* net_log);
293 // Merge the responses of blocked onAuthRequired handlers. The first 293 // Merge the responses of blocked onAuthRequired handlers. The first
294 // registered listener that supplies authentication credentials in a response, 294 // registered listener that supplies authentication credentials in a response,
295 // if any, will have its authentication credentials used. |request| must be 295 // if any, will have its authentication credentials used. |request| must be
296 // non-NULL, and contain |deltas| that are sorted in decreasing order of 296 // non-NULL, and contain |deltas| that are sorted in decreasing order of
297 // precedence. 297 // precedence.
298 // Returns whether authentication credentials are set. 298 // Returns whether authentication credentials are set.
299 bool MergeOnAuthRequiredResponses( 299 bool MergeOnAuthRequiredResponses(
300 const EventResponseDeltas& deltas, 300 const EventResponseDeltas& deltas,
301 net::AuthCredentials* auth_credentials, 301 net::AuthCredentials* auth_credentials,
302 extensions::ExtensionWarningSet* conflicting_extensions, 302 extensions::WarningSet* conflicting_extensions,
303 const net::BoundNetLog* net_log); 303 const net::BoundNetLog* net_log);
304 304
305 // Returns whether |type| is a ResourceType that is handled by the web request 305 // Returns whether |type| is a ResourceType that is handled by the web request
306 // API. 306 // API.
307 bool IsRelevantResourceType(content::ResourceType type); 307 bool IsRelevantResourceType(content::ResourceType type);
308 308
309 // Returns a string representation of |type| or |other| if |type| is not handled 309 // Returns a string representation of |type| or |other| if |type| is not handled
310 // by the web request API. 310 // by the web request API.
311 const char* ResourceTypeToString(content::ResourceType type); 311 const char* ResourceTypeToString(content::ResourceType type);
312 312
313 // Stores a |content::ResourceType| representation in |type| if |type_str| is 313 // Stores a |content::ResourceType| representation in |type| if |type_str| is
314 // a resource type handled by the web request API. Returns true in case of 314 // a resource type handled by the web request API. Returns true in case of
315 // success. 315 // success.
316 bool ParseResourceType(const std::string& type_str, 316 bool ParseResourceType(const std::string& type_str,
317 content::ResourceType* type); 317 content::ResourceType* type);
318 318
319 // Triggers clearing each renderer's in-memory cache the next time it navigates. 319 // Triggers clearing each renderer's in-memory cache the next time it navigates.
320 void ClearCacheOnNavigation(); 320 void ClearCacheOnNavigation();
321 321
322 // Tells renderer processes that the web request or declarative web request 322 // Tells renderer processes that the web request or declarative web request
323 // API has been used by |extension| in profile |profile_id| to collect 323 // API has been used by |extension| in profile |profile_id| to collect
324 // UMA statistics on Page Load Times. Needs to be called on the UI thread. 324 // UMA statistics on Page Load Times. Needs to be called on the UI thread.
325 void NotifyWebRequestAPIUsed( 325 void NotifyWebRequestAPIUsed(
326 void* profile_id, 326 void* profile_id,
327 scoped_refptr<const extensions::Extension> extension); 327 scoped_refptr<const extensions::Extension> extension);
328 328
329 } // namespace extension_web_request_api_helpers 329 } // namespace extension_web_request_api_helpers
330 330
331 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ 331 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698