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 // This class represents contextual information (cookies, cache, etc.) | 5 // This class represents contextual information (cookies, cache, etc.) |
6 // that's useful when processing resource requests. | 6 // that's useful when processing resource requests. |
7 // The class is reference-counted so that it can be cleaned up after any | 7 // The class is reference-counted so that it can be cleaned up after any |
8 // requests that are using it have been completed. | 8 // requests that are using it have been completed. |
9 | 9 |
10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
(...skipping 26 matching lines...) Expand all Loading... |
37 // Subclass to provide application-specific context for URLRequest | 37 // Subclass to provide application-specific context for URLRequest |
38 // instances. Note that URLRequestContext typically does not provide storage for | 38 // instances. Note that URLRequestContext typically does not provide storage for |
39 // these member variables, since they may be shared. For the ones that aren't | 39 // these member variables, since they may be shared. For the ones that aren't |
40 // shared, URLRequestContextStorage can be helpful in defining their storage. | 40 // shared, URLRequestContextStorage can be helpful in defining their storage. |
41 class URLRequestContext | 41 class URLRequestContext |
42 : public base::RefCountedThreadSafe<URLRequestContext>, | 42 : public base::RefCountedThreadSafe<URLRequestContext>, |
43 public base::NonThreadSafe { | 43 public base::NonThreadSafe { |
44 public: | 44 public: |
45 URLRequestContext(); | 45 URLRequestContext(); |
46 | 46 |
| 47 // Copies the state from |other| into this context. |
| 48 void CopyFrom(URLRequestContext* other); |
| 49 |
47 NetLog* net_log() const { | 50 NetLog* net_log() const { |
48 return net_log_; | 51 return net_log_; |
49 } | 52 } |
50 | 53 |
51 void set_net_log(NetLog* net_log) { | 54 void set_net_log(NetLog* net_log) { |
52 net_log_ = net_log; | 55 net_log_ = net_log; |
53 } | 56 } |
54 | 57 |
55 HostResolver* host_resolver() const { | 58 HostResolver* host_resolver() const { |
56 return host_resolver_; | 59 return host_resolver_; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // "main" URLRequestContext. | 179 // "main" URLRequestContext. |
177 bool is_main() const { return is_main_; } | 180 bool is_main() const { return is_main_; } |
178 void set_is_main(bool is_main) { is_main_ = is_main; } | 181 void set_is_main(bool is_main) { is_main_ = is_main; } |
179 | 182 |
180 protected: | 183 protected: |
181 friend class base::RefCountedThreadSafe<URLRequestContext>; | 184 friend class base::RefCountedThreadSafe<URLRequestContext>; |
182 | 185 |
183 virtual ~URLRequestContext(); | 186 virtual ~URLRequestContext(); |
184 | 187 |
185 private: | 188 private: |
| 189 // --------------------------------------------------------------------------- |
| 190 // Important: When adding any new members below, consider whether they need to |
| 191 // be added to CopyFrom. |
| 192 // --------------------------------------------------------------------------- |
| 193 |
186 // Indicates whether or not this is the main URLRequestContext. | 194 // Indicates whether or not this is the main URLRequestContext. |
187 bool is_main_; | 195 bool is_main_; |
188 | 196 |
189 // Ownership for these members are not defined here. Clients should either | 197 // Ownership for these members are not defined here. Clients should either |
190 // provide storage elsewhere or have a subclass take ownership. | 198 // provide storage elsewhere or have a subclass take ownership. |
191 NetLog* net_log_; | 199 NetLog* net_log_; |
192 HostResolver* host_resolver_; | 200 HostResolver* host_resolver_; |
193 CertVerifier* cert_verifier_; | 201 CertVerifier* cert_verifier_; |
194 DnsRRResolver* dnsrr_resolver_; | 202 DnsRRResolver* dnsrr_resolver_; |
195 DnsCertProvenanceChecker* dns_cert_checker_; | 203 DnsCertProvenanceChecker* dns_cert_checker_; |
196 HttpAuthHandlerFactory* http_auth_handler_factory_; | 204 HttpAuthHandlerFactory* http_auth_handler_factory_; |
197 scoped_refptr<ProxyService> proxy_service_; | 205 scoped_refptr<ProxyService> proxy_service_; |
198 scoped_refptr<SSLConfigService> ssl_config_service_; | 206 scoped_refptr<SSLConfigService> ssl_config_service_; |
199 NetworkDelegate* network_delegate_; | 207 NetworkDelegate* network_delegate_; |
200 scoped_refptr<CookieStore> cookie_store_; | 208 scoped_refptr<CookieStore> cookie_store_; |
201 CookiePolicy* cookie_policy_; | 209 CookiePolicy* cookie_policy_; |
202 scoped_refptr<TransportSecurityState> transport_security_state_; | 210 scoped_refptr<TransportSecurityState> transport_security_state_; |
203 FtpAuthCache ftp_auth_cache_; | 211 FtpAuthCache ftp_auth_cache_; |
204 std::string accept_language_; | 212 std::string accept_language_; |
205 std::string accept_charset_; | 213 std::string accept_charset_; |
206 // The charset of the referrer where this request comes from. It's not | 214 // The charset of the referrer where this request comes from. It's not |
207 // used in communication with a server but is used to construct a suggested | 215 // used in communication with a server but is used to construct a suggested |
208 // filename for file download. | 216 // filename for file download. |
209 std::string referrer_charset_; | 217 std::string referrer_charset_; |
210 | 218 |
211 HttpTransactionFactory* http_transaction_factory_; | 219 HttpTransactionFactory* http_transaction_factory_; |
212 FtpTransactionFactory* ftp_transaction_factory_; | 220 FtpTransactionFactory* ftp_transaction_factory_; |
213 | 221 |
| 222 // --------------------------------------------------------------------------- |
| 223 // Important: When adding any new members below, consider whether they need to |
| 224 // be added to CopyFrom. |
| 225 // --------------------------------------------------------------------------- |
| 226 |
214 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 227 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
215 }; | 228 }; |
216 | 229 |
217 } // namespace net | 230 } // namespace net |
218 | 231 |
219 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 232 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |