| OLD | NEW |
| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "content/public/common/resource_type.h" | 19 #include "content/public/common/resource_type.h" |
| 20 #include "extensions/browser/warning_set.h" | 20 #include "extensions/browser/warning_set.h" |
| 21 #include "net/base/auth.h" | 21 #include "net/base/auth.h" |
| 22 #include "net/cert/x509_certificate.h" |
| 22 #include "net/http/http_request_headers.h" | 23 #include "net/http/http_request_headers.h" |
| 23 #include "net/http/http_response_headers.h" | 24 #include "net/http/http_response_headers.h" |
| 25 #include "net/ssl/ssl_info.h" |
| 24 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 25 | 27 |
| 26 namespace base { | 28 namespace base { |
| 27 class ListValue; | 29 class ListValue; |
| 28 class Value; | 30 class Value; |
| 29 } | 31 } |
| 30 | 32 |
| 31 namespace content { | 33 namespace content { |
| 32 class RenderProcessHost; | 34 class RenderProcessHost; |
| 33 } | 35 } |
| 34 | 36 |
| 35 namespace extensions { | 37 namespace extensions { |
| 36 class Extension; | 38 class Extension; |
| 37 } | 39 } |
| 38 | 40 |
| 39 namespace net { | 41 namespace net { |
| 40 class BoundNetLog; | 42 class BoundNetLog; |
| 41 class URLRequest; | 43 class URLRequest; |
| 44 class X509Certificate; |
| 42 } | 45 } |
| 43 | 46 |
| 44 namespace extension_web_request_api_helpers { | 47 namespace extension_web_request_api_helpers { |
| 45 | 48 |
| 46 typedef std::pair<std::string, std::string> ResponseHeader; | 49 typedef std::pair<std::string, std::string> ResponseHeader; |
| 47 typedef std::vector<ResponseHeader> ResponseHeaders; | 50 typedef std::vector<ResponseHeader> ResponseHeaders; |
| 48 | 51 |
| 49 // Internal representation of the extraInfoSpec parameter on webRequest | 52 // Internal representation of the extraInfoSpec parameter on webRequest |
| 50 // events, used to specify extra information to be included with network | 53 // events, used to specify extra information to be included with network |
| 51 // events. | 54 // events. |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 // Returns a string representation of |type| or |other| if |type| is not handled | 356 // Returns a string representation of |type| or |other| if |type| is not handled |
| 354 // by the web request API. | 357 // by the web request API. |
| 355 const char* ResourceTypeToString(content::ResourceType type); | 358 const char* ResourceTypeToString(content::ResourceType type); |
| 356 | 359 |
| 357 // Stores a |content::ResourceType| representation in |types| if |type_str| is | 360 // Stores a |content::ResourceType| representation in |types| if |type_str| is |
| 358 // a resource type handled by the web request API. Returns true in case of | 361 // a resource type handled by the web request API. Returns true in case of |
| 359 // success. | 362 // success. |
| 360 bool ParseResourceType(const std::string& type_str, | 363 bool ParseResourceType(const std::string& type_str, |
| 361 std::vector<content::ResourceType>* types); | 364 std::vector<content::ResourceType>* types); |
| 362 | 365 |
| 366 // Returns a list of dictionaries containing various information about the chain |
| 367 // of certificates referenced by |cert|. Ownership is passed to the caller. |
| 368 base::ListValue* ExtractCertificateChain( |
| 369 scoped_refptr<net::X509Certificate> cert); |
| 370 |
| 371 // Returns a list of SSL errors contained within |status|. Ownership is passed |
| 372 // to the caller. |
| 373 base::ListValue* ParseCertificateStatusErrors(net::CertStatus status); |
| 374 |
| 375 // Returns a dictionary containing various information about the TLS/SSL |
| 376 // transport |
| 377 // described by |ssl_info|. Ownership is passed to the caller. |
| 378 base::DictionaryValue* ExtractConnectionInfo(net::SSLInfo ssl_info); |
| 379 |
| 363 } // namespace extension_web_request_api_helpers | 380 } // namespace extension_web_request_api_helpers |
| 364 | 381 |
| 365 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ | 382 #endif // EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_ |
| OLD | NEW |