OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "net/base/net_api.h" | 12 #include "net/base/net_api.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 class CertVerifier; | 16 class CertVerifier; |
17 class CookieStore; | 17 class CookieStore; |
18 class DnsCertProvenanceChecker; | 18 class DnsCertProvenanceChecker; |
19 class DnsRRResolver; | 19 class DnsRRResolver; |
20 class FtpTransactionFactory; | 20 class FtpTransactionFactory; |
21 class HostResolver; | 21 class HostResolver; |
22 class HttpAuthHandlerFactory; | 22 class HttpAuthHandlerFactory; |
23 class HttpTransactionFactory; | 23 class HttpTransactionFactory; |
24 class NetLog; | 24 class NetLog; |
25 class NetworkDelegate; | 25 class NetworkDelegate; |
| 26 class OriginBoundCertService; |
26 class ProxyService; | 27 class ProxyService; |
27 class SSLConfigService; | 28 class SSLConfigService; |
28 class TransportSecurityState; | 29 class TransportSecurityState; |
29 class URLRequestContext; | 30 class URLRequestContext; |
30 class URLRequestJobFactory; | 31 class URLRequestJobFactory; |
31 | 32 |
32 // URLRequestContextStorage is a helper class that provides storage for unowned | 33 // URLRequestContextStorage is a helper class that provides storage for unowned |
33 // member variables of URLRequestContext. | 34 // member variables of URLRequestContext. |
34 class NET_API URLRequestContextStorage { | 35 class NET_API URLRequestContextStorage { |
35 public: | 36 public: |
36 // Note that URLRequestContextStorage does not acquire a reference to | 37 // Note that URLRequestContextStorage does not acquire a reference to |
37 // URLRequestContext, since it is often designed to be embedded in a | 38 // URLRequestContext, since it is often designed to be embedded in a |
38 // URLRequestContext subclass. | 39 // URLRequestContext subclass. |
39 explicit URLRequestContextStorage(URLRequestContext* context); | 40 explicit URLRequestContextStorage(URLRequestContext* context); |
40 ~URLRequestContextStorage(); | 41 ~URLRequestContextStorage(); |
41 | 42 |
42 // These setters will set both the member variables and call the setter on the | 43 // These setters will set both the member variables and call the setter on the |
43 // URLRequestContext object. | 44 // URLRequestContext object. |
44 | 45 |
45 void set_net_log(NetLog* net_log); | 46 void set_net_log(NetLog* net_log); |
46 void set_host_resolver(HostResolver* host_resolver); | 47 void set_host_resolver(HostResolver* host_resolver); |
47 void set_cert_verifier(CertVerifier* cert_verifier); | 48 void set_cert_verifier(CertVerifier* cert_verifier); |
| 49 void set_origin_bound_cert_service( |
| 50 OriginBoundCertService* origin_bound_cert_service); |
48 void set_dnsrr_resolver(DnsRRResolver* dnsrr_resolver); | 51 void set_dnsrr_resolver(DnsRRResolver* dnsrr_resolver); |
49 void set_dns_cert_checker(DnsCertProvenanceChecker* dns_cert_checker); | 52 void set_dns_cert_checker(DnsCertProvenanceChecker* dns_cert_checker); |
50 void set_http_auth_handler_factory( | 53 void set_http_auth_handler_factory( |
51 HttpAuthHandlerFactory* http_auth_handler_factory); | 54 HttpAuthHandlerFactory* http_auth_handler_factory); |
52 void set_proxy_service(ProxyService* proxy_service); | 55 void set_proxy_service(ProxyService* proxy_service); |
53 void set_ssl_config_service(SSLConfigService* ssl_config_service); | 56 void set_ssl_config_service(SSLConfigService* ssl_config_service); |
54 void set_network_delegate(NetworkDelegate* network_delegate); | 57 void set_network_delegate(NetworkDelegate* network_delegate); |
55 void set_cookie_store(CookieStore* cookie_store); | 58 void set_cookie_store(CookieStore* cookie_store); |
56 void set_transport_security_state( | 59 void set_transport_security_state( |
57 TransportSecurityState* transport_security_state); | 60 TransportSecurityState* transport_security_state); |
58 void set_http_transaction_factory( | 61 void set_http_transaction_factory( |
59 HttpTransactionFactory* http_transaction_factory); | 62 HttpTransactionFactory* http_transaction_factory); |
60 void set_ftp_transaction_factory( | 63 void set_ftp_transaction_factory( |
61 FtpTransactionFactory* ftp_transaction_factory); | 64 FtpTransactionFactory* ftp_transaction_factory); |
62 void set_job_factory(URLRequestJobFactory* job_factory); | 65 void set_job_factory(URLRequestJobFactory* job_factory); |
63 | 66 |
64 private: | 67 private: |
65 // We use a raw pointer to prevent reference cycles, since | 68 // We use a raw pointer to prevent reference cycles, since |
66 // URLRequestContextStorage can often be contained within a URLRequestContext | 69 // URLRequestContextStorage can often be contained within a URLRequestContext |
67 // subclass. | 70 // subclass. |
68 URLRequestContext* const context_; | 71 URLRequestContext* const context_; |
69 | 72 |
70 // Owned members. | 73 // Owned members. |
71 scoped_ptr<NetLog> net_log_; | 74 scoped_ptr<NetLog> net_log_; |
72 scoped_ptr<HostResolver> host_resolver_; | 75 scoped_ptr<HostResolver> host_resolver_; |
73 scoped_ptr<CertVerifier> cert_verifier_; | 76 scoped_ptr<CertVerifier> cert_verifier_; |
| 77 scoped_ptr<OriginBoundCertService> origin_bound_cert_service_; |
74 scoped_ptr<DnsRRResolver> dnsrr_resolver_; | 78 scoped_ptr<DnsRRResolver> dnsrr_resolver_; |
75 scoped_ptr<DnsCertProvenanceChecker> dns_cert_checker_; | 79 scoped_ptr<DnsCertProvenanceChecker> dns_cert_checker_; |
76 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 80 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
77 scoped_ptr<ProxyService> proxy_service_; | 81 scoped_ptr<ProxyService> proxy_service_; |
78 // TODO(willchan): Remove refcounting on these members. | 82 // TODO(willchan): Remove refcounting on these members. |
79 scoped_refptr<SSLConfigService> ssl_config_service_; | 83 scoped_refptr<SSLConfigService> ssl_config_service_; |
80 scoped_ptr<NetworkDelegate> network_delegate_; | 84 scoped_ptr<NetworkDelegate> network_delegate_; |
81 scoped_refptr<CookieStore> cookie_store_; | 85 scoped_refptr<CookieStore> cookie_store_; |
82 scoped_refptr<TransportSecurityState> transport_security_state_; | 86 scoped_refptr<TransportSecurityState> transport_security_state_; |
83 | 87 |
84 scoped_ptr<HttpTransactionFactory> http_transaction_factory_; | 88 scoped_ptr<HttpTransactionFactory> http_transaction_factory_; |
85 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 89 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
86 scoped_ptr<URLRequestJobFactory> job_factory_; | 90 scoped_ptr<URLRequestJobFactory> job_factory_; |
87 | 91 |
88 DISALLOW_COPY_AND_ASSIGN(URLRequestContextStorage); | 92 DISALLOW_COPY_AND_ASSIGN(URLRequestContextStorage); |
89 }; | 93 }; |
90 | 94 |
91 } // namespace net | 95 } // namespace net |
92 | 96 |
93 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ | 97 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ |
OLD | NEW |