| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "net/base/cookie_policy.h" | 15 #include "net/base/cookie_policy.h" |
| 16 #include "net/base/cookie_store.h" | 16 #include "net/base/cookie_store.h" |
| 17 #include "net/base/host_resolver.h" | 17 #include "net/base/host_resolver.h" |
| 18 #include "net/ftp/ftp_auth_cache.h" | 18 #include "net/ftp/ftp_auth_cache.h" |
| 19 #include "net/proxy/proxy_service.h" |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 class ForceTLSState; | 22 class ForceTLSState; |
| 22 class FtpTransactionFactory; | 23 class FtpTransactionFactory; |
| 23 class HttpTransactionFactory; | 24 class HttpTransactionFactory; |
| 24 class ProxyService; | |
| 25 } | 25 } |
| 26 class URLRequest; | 26 class URLRequest; |
| 27 | 27 |
| 28 // Subclass to provide application-specific context for URLRequest instances. | 28 // Subclass to provide application-specific context for URLRequest instances. |
| 29 class URLRequestContext : | 29 class URLRequestContext : |
| 30 public base::RefCountedThreadSafe<URLRequestContext> { | 30 public base::RefCountedThreadSafe<URLRequestContext> { |
| 31 public: | 31 public: |
| 32 URLRequestContext() | 32 URLRequestContext() |
| 33 : host_resolver_(NULL), | 33 : http_transaction_factory_(NULL), |
| 34 proxy_service_(NULL), | |
| 35 http_transaction_factory_(NULL), | |
| 36 ftp_transaction_factory_(NULL), | 34 ftp_transaction_factory_(NULL), |
| 37 cookie_store_(NULL), | 35 cookie_store_(NULL), |
| 38 force_tls_state_(NULL) { | 36 force_tls_state_(NULL) { |
| 39 } | 37 } |
| 40 | 38 |
| 41 net::HostResolver* host_resolver() const { | 39 net::HostResolver* host_resolver() const { |
| 42 return host_resolver_; | 40 return host_resolver_; |
| 43 } | 41 } |
| 44 | 42 |
| 45 // Get the proxy service for this context. | 43 // Get the proxy service for this context. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 100 } |
| 103 | 101 |
| 104 protected: | 102 protected: |
| 105 friend class base::RefCountedThreadSafe<URLRequestContext>; | 103 friend class base::RefCountedThreadSafe<URLRequestContext>; |
| 106 | 104 |
| 107 virtual ~URLRequestContext() {} | 105 virtual ~URLRequestContext() {} |
| 108 | 106 |
| 109 // The following members are expected to be initialized and owned by | 107 // The following members are expected to be initialized and owned by |
| 110 // subclasses. | 108 // subclasses. |
| 111 scoped_refptr<net::HostResolver> host_resolver_; | 109 scoped_refptr<net::HostResolver> host_resolver_; |
| 112 net::ProxyService* proxy_service_; | 110 scoped_refptr<net::ProxyService> proxy_service_; |
| 113 net::HttpTransactionFactory* http_transaction_factory_; | 111 net::HttpTransactionFactory* http_transaction_factory_; |
| 114 net::FtpTransactionFactory* ftp_transaction_factory_; | 112 net::FtpTransactionFactory* ftp_transaction_factory_; |
| 115 net::CookieStore* cookie_store_; | 113 net::CookieStore* cookie_store_; |
| 116 net::CookiePolicy cookie_policy_; | 114 net::CookiePolicy cookie_policy_; |
| 117 net::ForceTLSState* force_tls_state_;; | 115 net::ForceTLSState* force_tls_state_;; |
| 118 net::FtpAuthCache ftp_auth_cache_; | 116 net::FtpAuthCache ftp_auth_cache_; |
| 119 std::string accept_language_; | 117 std::string accept_language_; |
| 120 std::string accept_charset_; | 118 std::string accept_charset_; |
| 121 // The charset of the referrer where this request comes from. It's not | 119 // The charset of the referrer where this request comes from. It's not |
| 122 // used in communication with a server but is used to construct a suggested | 120 // used in communication with a server but is used to construct a suggested |
| 123 // filename for file download. | 121 // filename for file download. |
| 124 std::string referrer_charset_; | 122 std::string referrer_charset_; |
| 125 | 123 |
| 126 private: | 124 private: |
| 127 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 125 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
| 128 }; | 126 }; |
| 129 | 127 |
| 130 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 128 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |