| 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 // 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 | 12 |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
| 20 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 21 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
| 22 #include "net/base/ssl_config_service.h" | 22 #include "net/base/ssl_config_service.h" |
| 23 #include "net/base/transport_security_state.h" | 23 #include "net/base/transport_security_state.h" |
| 24 #include "net/http/http_network_session.h" | 24 #include "net/http/http_network_session.h" |
| 25 #include "net/http/http_server_properties.h" | 25 #include "net/http/http_server_properties.h" |
| 26 #include "net/ftp/ftp_auth_cache.h" | |
| 27 #include "net/url_request/url_request.h" | 26 #include "net/url_request/url_request.h" |
| 28 | 27 |
| 29 namespace net { | 28 namespace net { |
| 30 class CertVerifier; | 29 class CertVerifier; |
| 31 class CookieStore; | 30 class CookieStore; |
| 32 class FraudulentCertificateReporter; | 31 class FraudulentCertificateReporter; |
| 33 class FtpTransactionFactory; | |
| 34 class HostResolver; | 32 class HostResolver; |
| 35 class HttpAuthHandlerFactory; | 33 class HttpAuthHandlerFactory; |
| 36 class HttpTransactionFactory; | 34 class HttpTransactionFactory; |
| 37 class HttpUserAgentSettings; | 35 class HttpUserAgentSettings; |
| 38 class NetworkDelegate; | 36 class NetworkDelegate; |
| 39 class ServerBoundCertService; | 37 class ServerBoundCertService; |
| 40 class ProxyService; | 38 class ProxyService; |
| 41 class URLRequest; | 39 class URLRequest; |
| 42 class URLRequestJobFactory; | 40 class URLRequestJobFactory; |
| 43 class URLRequestThrottlerManager; | 41 class URLRequestThrottlerManager; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 122 } |
| 125 | 123 |
| 126 // Gets the http transaction factory for this context. | 124 // Gets the http transaction factory for this context. |
| 127 HttpTransactionFactory* http_transaction_factory() const { | 125 HttpTransactionFactory* http_transaction_factory() const { |
| 128 return http_transaction_factory_; | 126 return http_transaction_factory_; |
| 129 } | 127 } |
| 130 void set_http_transaction_factory(HttpTransactionFactory* factory) { | 128 void set_http_transaction_factory(HttpTransactionFactory* factory) { |
| 131 http_transaction_factory_ = factory; | 129 http_transaction_factory_ = factory; |
| 132 } | 130 } |
| 133 | 131 |
| 134 // Gets the ftp transaction factory for this context. | |
| 135 FtpTransactionFactory* ftp_transaction_factory() const { | |
| 136 return ftp_transaction_factory_; | |
| 137 } | |
| 138 void set_ftp_transaction_factory(FtpTransactionFactory* factory) { | |
| 139 ftp_transaction_factory_ = factory; | |
| 140 } | |
| 141 | |
| 142 void set_network_delegate(NetworkDelegate* network_delegate) { | 132 void set_network_delegate(NetworkDelegate* network_delegate) { |
| 143 network_delegate_ = network_delegate; | 133 network_delegate_ = network_delegate; |
| 144 } | 134 } |
| 145 NetworkDelegate* network_delegate() const { return network_delegate_; } | 135 NetworkDelegate* network_delegate() const { return network_delegate_; } |
| 146 | 136 |
| 147 void set_http_server_properties( | 137 void set_http_server_properties( |
| 148 HttpServerProperties* http_server_properties) { | 138 HttpServerProperties* http_server_properties) { |
| 149 http_server_properties_ = http_server_properties; | 139 http_server_properties_ = http_server_properties; |
| 150 } | 140 } |
| 151 HttpServerProperties* http_server_properties() const { | 141 HttpServerProperties* http_server_properties() const { |
| 152 return http_server_properties_; | 142 return http_server_properties_; |
| 153 } | 143 } |
| 154 | 144 |
| 155 // Gets the cookie store for this context (may be null, in which case | 145 // Gets the cookie store for this context (may be null, in which case |
| 156 // cookies are not stored). | 146 // cookies are not stored). |
| 157 CookieStore* cookie_store() const { return cookie_store_.get(); } | 147 CookieStore* cookie_store() const { return cookie_store_.get(); } |
| 158 void set_cookie_store(CookieStore* cookie_store); | 148 void set_cookie_store(CookieStore* cookie_store); |
| 159 | 149 |
| 160 TransportSecurityState* transport_security_state() const { | 150 TransportSecurityState* transport_security_state() const { |
| 161 return transport_security_state_; | 151 return transport_security_state_; |
| 162 } | 152 } |
| 163 void set_transport_security_state( | 153 void set_transport_security_state( |
| 164 TransportSecurityState* state) { | 154 TransportSecurityState* state) { |
| 165 transport_security_state_ = state; | 155 transport_security_state_ = state; |
| 166 } | 156 } |
| 167 | 157 |
| 168 // Gets the FTP authentication cache for this context. | |
| 169 FtpAuthCache* ftp_auth_cache() const { | |
| 170 #if !defined(DISABLE_FTP_SUPPORT) | |
| 171 return ftp_auth_cache_.get(); | |
| 172 #else | |
| 173 return NULL; | |
| 174 #endif | |
| 175 } | |
| 176 | |
| 177 // --------------------------------------------------------------------------- | 158 // --------------------------------------------------------------------------- |
| 178 // Legacy accessors that delegate to http_user_agent_settings_. | 159 // Legacy accessors that delegate to http_user_agent_settings_. |
| 179 // TODO(pauljensen): Remove after all clients are updated to directly access | 160 // TODO(pauljensen): Remove after all clients are updated to directly access |
| 180 // http_user_agent_settings_. | 161 // http_user_agent_settings_. |
| 181 // Gets the value of 'Accept-Charset' header field. | 162 // Gets the value of 'Accept-Charset' header field. |
| 182 std::string GetAcceptCharset() const; | 163 std::string GetAcceptCharset() const; |
| 183 // Gets the value of 'Accept-Language' header field. | 164 // Gets the value of 'Accept-Language' header field. |
| 184 std::string GetAcceptLanguage() const; | 165 std::string GetAcceptLanguage() const; |
| 185 // Gets the UA string to use for the given URL. Pass an invalid URL (such as | 166 // Gets the UA string to use for the given URL. Pass an invalid URL (such as |
| 186 // GURL()) to get the default UA string. | 167 // GURL()) to get the default UA string. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 ServerBoundCertService* server_bound_cert_service_; | 213 ServerBoundCertService* server_bound_cert_service_; |
| 233 FraudulentCertificateReporter* fraudulent_certificate_reporter_; | 214 FraudulentCertificateReporter* fraudulent_certificate_reporter_; |
| 234 HttpAuthHandlerFactory* http_auth_handler_factory_; | 215 HttpAuthHandlerFactory* http_auth_handler_factory_; |
| 235 ProxyService* proxy_service_; | 216 ProxyService* proxy_service_; |
| 236 scoped_refptr<SSLConfigService> ssl_config_service_; | 217 scoped_refptr<SSLConfigService> ssl_config_service_; |
| 237 NetworkDelegate* network_delegate_; | 218 NetworkDelegate* network_delegate_; |
| 238 HttpServerProperties* http_server_properties_; | 219 HttpServerProperties* http_server_properties_; |
| 239 HttpUserAgentSettings* http_user_agent_settings_; | 220 HttpUserAgentSettings* http_user_agent_settings_; |
| 240 scoped_refptr<CookieStore> cookie_store_; | 221 scoped_refptr<CookieStore> cookie_store_; |
| 241 TransportSecurityState* transport_security_state_; | 222 TransportSecurityState* transport_security_state_; |
| 242 #if !defined(DISABLE_FTP_SUPPORT) | |
| 243 scoped_ptr<FtpAuthCache> ftp_auth_cache_; | |
| 244 #endif | |
| 245 // The charset of the referrer where this request comes from. It's not | 223 // The charset of the referrer where this request comes from. It's not |
| 246 // used in communication with a server but is used to construct a suggested | 224 // used in communication with a server but is used to construct a suggested |
| 247 // filename for file download. | 225 // filename for file download. |
| 248 HttpTransactionFactory* http_transaction_factory_; | 226 HttpTransactionFactory* http_transaction_factory_; |
| 249 FtpTransactionFactory* ftp_transaction_factory_; | |
| 250 const URLRequestJobFactory* job_factory_; | 227 const URLRequestJobFactory* job_factory_; |
| 251 URLRequestThrottlerManager* throttler_manager_; | 228 URLRequestThrottlerManager* throttler_manager_; |
| 252 | 229 |
| 253 // --------------------------------------------------------------------------- | 230 // --------------------------------------------------------------------------- |
| 254 // Important: When adding any new members below, consider whether they need to | 231 // Important: When adding any new members below, consider whether they need to |
| 255 // be added to CopyFrom. | 232 // be added to CopyFrom. |
| 256 // --------------------------------------------------------------------------- | 233 // --------------------------------------------------------------------------- |
| 257 | 234 |
| 258 scoped_ptr<std::set<const URLRequest*> > url_requests_; | 235 scoped_ptr<std::set<const URLRequest*> > url_requests_; |
| 259 | 236 |
| 260 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 237 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
| 261 }; | 238 }; |
| 262 | 239 |
| 263 } // namespace net | 240 } // namespace net |
| 264 | 241 |
| 265 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 242 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |