OLD | NEW |
1 // Copyright (c) 2011 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 #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_export.h" | 12 #include "net/base/net_export.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 FraudulentCertificateReporter; | 18 class FraudulentCertificateReporter; |
19 class FtpTransactionFactory; | 19 class FtpTransactionFactory; |
20 class HostResolver; | 20 class HostResolver; |
21 class HttpAuthHandlerFactory; | 21 class HttpAuthHandlerFactory; |
22 class HttpServerProperties; | 22 class HttpServerProperties; |
23 class HttpTransactionFactory; | 23 class HttpTransactionFactory; |
24 class NetLog; | 24 class NetLog; |
25 class NetworkDelegate; | 25 class NetworkDelegate; |
26 class OriginBoundCertService; | 26 class ServerBoundCertService; |
27 class ProxyService; | 27 class ProxyService; |
28 class SSLConfigService; | 28 class SSLConfigService; |
29 class TransportSecurityState; | 29 class TransportSecurityState; |
30 class URLRequestContext; | 30 class URLRequestContext; |
31 class URLRequestJobFactory; | 31 class URLRequestJobFactory; |
32 | 32 |
33 // URLRequestContextStorage is a helper class that provides storage for unowned | 33 // URLRequestContextStorage is a helper class that provides storage for unowned |
34 // member variables of URLRequestContext. | 34 // member variables of URLRequestContext. |
35 class NET_EXPORT URLRequestContextStorage { | 35 class NET_EXPORT URLRequestContextStorage { |
36 public: | 36 public: |
37 // Note that URLRequestContextStorage does not acquire a reference to | 37 // Note that URLRequestContextStorage does not acquire a reference to |
38 // URLRequestContext, since it is often designed to be embedded in a | 38 // URLRequestContext, since it is often designed to be embedded in a |
39 // URLRequestContext subclass. | 39 // URLRequestContext subclass. |
40 explicit URLRequestContextStorage(URLRequestContext* context); | 40 explicit URLRequestContextStorage(URLRequestContext* context); |
41 ~URLRequestContextStorage(); | 41 ~URLRequestContextStorage(); |
42 | 42 |
43 // 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 |
44 // URLRequestContext object. | 44 // URLRequestContext object. |
45 | 45 |
46 void set_net_log(NetLog* net_log); | 46 void set_net_log(NetLog* net_log); |
47 void set_host_resolver(HostResolver* host_resolver); | 47 void set_host_resolver(HostResolver* host_resolver); |
48 void set_cert_verifier(CertVerifier* cert_verifier); | 48 void set_cert_verifier(CertVerifier* cert_verifier); |
49 void set_origin_bound_cert_service( | 49 void set_server_bound_cert_service( |
50 OriginBoundCertService* origin_bound_cert_service); | 50 ServerBoundCertService* server_bound_cert_service); |
51 void set_fraudulent_certificate_reporter( | 51 void set_fraudulent_certificate_reporter( |
52 FraudulentCertificateReporter* fraudulent_certificate_reporter); | 52 FraudulentCertificateReporter* fraudulent_certificate_reporter); |
53 void set_http_auth_handler_factory( | 53 void set_http_auth_handler_factory( |
54 HttpAuthHandlerFactory* http_auth_handler_factory); | 54 HttpAuthHandlerFactory* http_auth_handler_factory); |
55 void set_proxy_service(ProxyService* proxy_service); | 55 void set_proxy_service(ProxyService* proxy_service); |
56 void set_ssl_config_service(SSLConfigService* ssl_config_service); | 56 void set_ssl_config_service(SSLConfigService* ssl_config_service); |
57 void set_network_delegate(NetworkDelegate* network_delegate); | 57 void set_network_delegate(NetworkDelegate* network_delegate); |
58 void set_http_server_properties(HttpServerProperties* http_server_properties); | 58 void set_http_server_properties(HttpServerProperties* http_server_properties); |
59 void set_cookie_store(CookieStore* cookie_store); | 59 void set_cookie_store(CookieStore* cookie_store); |
60 void set_transport_security_state( | 60 void set_transport_security_state( |
61 TransportSecurityState* transport_security_state); | 61 TransportSecurityState* transport_security_state); |
62 void set_http_transaction_factory( | 62 void set_http_transaction_factory( |
63 HttpTransactionFactory* http_transaction_factory); | 63 HttpTransactionFactory* http_transaction_factory); |
64 void set_ftp_transaction_factory( | 64 void set_ftp_transaction_factory( |
65 FtpTransactionFactory* ftp_transaction_factory); | 65 FtpTransactionFactory* ftp_transaction_factory); |
66 void set_job_factory(URLRequestJobFactory* job_factory); | 66 void set_job_factory(URLRequestJobFactory* job_factory); |
67 | 67 |
68 private: | 68 private: |
69 // We use a raw pointer to prevent reference cycles, since | 69 // We use a raw pointer to prevent reference cycles, since |
70 // URLRequestContextStorage can often be contained within a URLRequestContext | 70 // URLRequestContextStorage can often be contained within a URLRequestContext |
71 // subclass. | 71 // subclass. |
72 URLRequestContext* const context_; | 72 URLRequestContext* const context_; |
73 | 73 |
74 // Owned members. | 74 // Owned members. |
75 scoped_ptr<NetLog> net_log_; | 75 scoped_ptr<NetLog> net_log_; |
76 scoped_ptr<HostResolver> host_resolver_; | 76 scoped_ptr<HostResolver> host_resolver_; |
77 scoped_ptr<CertVerifier> cert_verifier_; | 77 scoped_ptr<CertVerifier> cert_verifier_; |
78 scoped_ptr<OriginBoundCertService> origin_bound_cert_service_; | 78 scoped_ptr<ServerBoundCertService> server_bound_cert_service_; |
79 scoped_ptr<FraudulentCertificateReporter> fraudulent_certificate_reporter_; | 79 scoped_ptr<FraudulentCertificateReporter> fraudulent_certificate_reporter_; |
80 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 80 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
81 scoped_ptr<ProxyService> proxy_service_; | 81 scoped_ptr<ProxyService> proxy_service_; |
82 // TODO(willchan): Remove refcounting on these members. | 82 // TODO(willchan): Remove refcounting on these members. |
83 scoped_refptr<SSLConfigService> ssl_config_service_; | 83 scoped_refptr<SSLConfigService> ssl_config_service_; |
84 scoped_ptr<NetworkDelegate> network_delegate_; | 84 scoped_ptr<NetworkDelegate> network_delegate_; |
85 scoped_ptr<HttpServerProperties> http_server_properties_; | 85 scoped_ptr<HttpServerProperties> http_server_properties_; |
86 scoped_refptr<CookieStore> cookie_store_; | 86 scoped_refptr<CookieStore> cookie_store_; |
87 scoped_ptr<TransportSecurityState> transport_security_state_; | 87 scoped_ptr<TransportSecurityState> transport_security_state_; |
88 | 88 |
89 scoped_ptr<HttpTransactionFactory> http_transaction_factory_; | 89 scoped_ptr<HttpTransactionFactory> http_transaction_factory_; |
90 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 90 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
91 scoped_ptr<URLRequestJobFactory> job_factory_; | 91 scoped_ptr<URLRequestJobFactory> job_factory_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(URLRequestContextStorage); | 93 DISALLOW_COPY_AND_ASSIGN(URLRequestContextStorage); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace net | 96 } // namespace net |
97 | 97 |
98 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ | 98 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ |
OLD | NEW |