| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_ |
| 11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| 12 #pragma once | 12 #pragma once |
| 13 | 13 |
| 14 #include "base/non_thread_safe.h" | 14 #include "base/non_thread_safe.h" |
| 15 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
| 16 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
| 17 #include "net/base/ssl_config_service.h" | 17 #include "net/base/ssl_config_service.h" |
| 18 #include "net/base/transport_security_state.h" | 18 #include "net/base/transport_security_state.h" |
| 19 #include "net/ftp/ftp_auth_cache.h" | 19 #include "net/ftp/ftp_auth_cache.h" |
| 20 #include "net/proxy/proxy_service.h" | 20 #include "net/proxy/proxy_service.h" |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 class CookiePolicy; | 23 class CookiePolicy; |
| 24 class CookieStore; | 24 class CookieStore; |
| 25 class DnsRRResolver; |
| 25 class FtpTransactionFactory; | 26 class FtpTransactionFactory; |
| 26 class HostResolver; | 27 class HostResolver; |
| 27 class HttpAuthHandlerFactory; | 28 class HttpAuthHandlerFactory; |
| 28 class HttpNetworkDelegate; | 29 class HttpNetworkDelegate; |
| 29 class HttpTransactionFactory; | 30 class HttpTransactionFactory; |
| 30 class SSLConfigService; | 31 class SSLConfigService; |
| 31 } | 32 } |
| 32 class URLRequest; | 33 class URLRequest; |
| 33 | 34 |
| 34 // Subclass to provide application-specific context for URLRequest instances. | 35 // Subclass to provide application-specific context for URLRequest instances. |
| 35 class URLRequestContext | 36 class URLRequestContext |
| 36 : public base::RefCountedThreadSafe<URLRequestContext>, | 37 : public base::RefCountedThreadSafe<URLRequestContext>, |
| 37 public NonThreadSafe { | 38 public NonThreadSafe { |
| 38 public: | 39 public: |
| 39 URLRequestContext(); | 40 URLRequestContext(); |
| 40 | 41 |
| 41 net::NetLog* net_log() const { | 42 net::NetLog* net_log() const { |
| 42 return net_log_; | 43 return net_log_; |
| 43 } | 44 } |
| 44 | 45 |
| 45 net::HostResolver* host_resolver() const { | 46 net::HostResolver* host_resolver() const { |
| 46 return host_resolver_; | 47 return host_resolver_; |
| 47 } | 48 } |
| 48 | 49 |
| 50 net::DnsRRResolver* dnsrr_resolver() const { |
| 51 return dnsrr_resolver_; |
| 52 } |
| 53 |
| 49 // Get the proxy service for this context. | 54 // Get the proxy service for this context. |
| 50 net::ProxyService* proxy_service() const { | 55 net::ProxyService* proxy_service() const { |
| 51 return proxy_service_; | 56 return proxy_service_; |
| 52 } | 57 } |
| 53 | 58 |
| 54 // Get the ssl config service for this context. | 59 // Get the ssl config service for this context. |
| 55 net::SSLConfigService* ssl_config_service() const { | 60 net::SSLConfigService* ssl_config_service() const { |
| 56 return ssl_config_service_; | 61 return ssl_config_service_; |
| 57 } | 62 } |
| 58 | 63 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 111 |
| 107 protected: | 112 protected: |
| 108 friend class base::RefCountedThreadSafe<URLRequestContext>; | 113 friend class base::RefCountedThreadSafe<URLRequestContext>; |
| 109 | 114 |
| 110 virtual ~URLRequestContext(); | 115 virtual ~URLRequestContext(); |
| 111 | 116 |
| 112 // The following members are expected to be initialized and owned by | 117 // The following members are expected to be initialized and owned by |
| 113 // subclasses. | 118 // subclasses. |
| 114 net::NetLog* net_log_; | 119 net::NetLog* net_log_; |
| 115 net::HostResolver* host_resolver_; | 120 net::HostResolver* host_resolver_; |
| 121 net::DnsRRResolver* dnsrr_resolver_; |
| 116 scoped_refptr<net::ProxyService> proxy_service_; | 122 scoped_refptr<net::ProxyService> proxy_service_; |
| 117 scoped_refptr<net::SSLConfigService> ssl_config_service_; | 123 scoped_refptr<net::SSLConfigService> ssl_config_service_; |
| 118 net::HttpTransactionFactory* http_transaction_factory_; | 124 net::HttpTransactionFactory* http_transaction_factory_; |
| 119 net::FtpTransactionFactory* ftp_transaction_factory_; | 125 net::FtpTransactionFactory* ftp_transaction_factory_; |
| 120 net::HttpAuthHandlerFactory* http_auth_handler_factory_; | 126 net::HttpAuthHandlerFactory* http_auth_handler_factory_; |
| 121 net::HttpNetworkDelegate* network_delegate_; | 127 net::HttpNetworkDelegate* network_delegate_; |
| 122 scoped_refptr<net::CookieStore> cookie_store_; | 128 scoped_refptr<net::CookieStore> cookie_store_; |
| 123 net::CookiePolicy* cookie_policy_; | 129 net::CookiePolicy* cookie_policy_; |
| 124 scoped_refptr<net::TransportSecurityState> transport_security_state_; | 130 scoped_refptr<net::TransportSecurityState> transport_security_state_; |
| 125 net::FtpAuthCache ftp_auth_cache_; | 131 net::FtpAuthCache ftp_auth_cache_; |
| 126 std::string accept_language_; | 132 std::string accept_language_; |
| 127 std::string accept_charset_; | 133 std::string accept_charset_; |
| 128 // The charset of the referrer where this request comes from. It's not | 134 // The charset of the referrer where this request comes from. It's not |
| 129 // used in communication with a server but is used to construct a suggested | 135 // used in communication with a server but is used to construct a suggested |
| 130 // filename for file download. | 136 // filename for file download. |
| 131 std::string referrer_charset_; | 137 std::string referrer_charset_; |
| 132 | 138 |
| 133 private: | 139 private: |
| 134 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 140 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
| 135 }; | 141 }; |
| 136 | 142 |
| 137 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 143 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |