| 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/ftp/ftp_auth_cache.h" | 16 #include "net/ftp/ftp_auth_cache.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 class CookieMonster; |
| 20 class FtpTransactionFactory; |
| 19 class HttpTransactionFactory; | 21 class HttpTransactionFactory; |
| 20 class CookieMonster; | |
| 21 class ProxyService; | 22 class ProxyService; |
| 22 } | 23 } |
| 23 | 24 |
| 24 // Subclass to provide application-specific context for URLRequest instances. | 25 // Subclass to provide application-specific context for URLRequest instances. |
| 25 class URLRequestContext : | 26 class URLRequestContext : |
| 26 public base::RefCountedThreadSafe<URLRequestContext> { | 27 public base::RefCountedThreadSafe<URLRequestContext> { |
| 27 public: | 28 public: |
| 28 URLRequestContext() | 29 URLRequestContext() |
| 29 : proxy_service_(NULL), | 30 : proxy_service_(NULL), |
| 30 http_transaction_factory_(NULL), | 31 http_transaction_factory_(NULL), |
| 32 ftp_transaction_factory_(NULL), |
| 31 cookie_store_(NULL) { | 33 cookie_store_(NULL) { |
| 32 } | 34 } |
| 33 | 35 |
| 34 // Get the proxy service for this context. | 36 // Get the proxy service for this context. |
| 35 net::ProxyService* proxy_service() const { | 37 net::ProxyService* proxy_service() const { |
| 36 return proxy_service_; | 38 return proxy_service_; |
| 37 } | 39 } |
| 38 | 40 |
| 39 // Gets the http transaction factory for this context. | 41 // Gets the http transaction factory for this context. |
| 40 net::HttpTransactionFactory* http_transaction_factory() { | 42 net::HttpTransactionFactory* http_transaction_factory() { |
| 41 return http_transaction_factory_; | 43 return http_transaction_factory_; |
| 42 } | 44 } |
| 43 | 45 |
| 46 // Gets the ftp transaction factory for this context. |
| 47 net::FtpTransactionFactory* ftp_transaction_factory() { |
| 48 return ftp_transaction_factory_; |
| 49 } |
| 50 |
| 44 // Gets the cookie store for this context. | 51 // Gets the cookie store for this context. |
| 45 net::CookieMonster* cookie_store() { return cookie_store_; } | 52 net::CookieMonster* cookie_store() { return cookie_store_; } |
| 46 | 53 |
| 47 // Gets the cookie policy for this context. | 54 // Gets the cookie policy for this context. |
| 48 net::CookiePolicy* cookie_policy() { return &cookie_policy_; } | 55 net::CookiePolicy* cookie_policy() { return &cookie_policy_; } |
| 49 | 56 |
| 50 // Gets the FTP authentication cache for this context. | 57 // Gets the FTP authentication cache for this context. |
| 51 net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; } | 58 net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; } |
| 52 | 59 |
| 53 // Gets the value of 'Accept-Charset' header field. | 60 // Gets the value of 'Accept-Charset' header field. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 | 72 |
| 66 protected: | 73 protected: |
| 67 friend class base::RefCountedThreadSafe<URLRequestContext>; | 74 friend class base::RefCountedThreadSafe<URLRequestContext>; |
| 68 | 75 |
| 69 virtual ~URLRequestContext() {} | 76 virtual ~URLRequestContext() {} |
| 70 | 77 |
| 71 // The following members are expected to be initialized and owned by | 78 // The following members are expected to be initialized and owned by |
| 72 // subclasses. | 79 // subclasses. |
| 73 net::ProxyService* proxy_service_; | 80 net::ProxyService* proxy_service_; |
| 74 net::HttpTransactionFactory* http_transaction_factory_; | 81 net::HttpTransactionFactory* http_transaction_factory_; |
| 82 net::FtpTransactionFactory* ftp_transaction_factory_; |
| 75 net::CookieMonster* cookie_store_; | 83 net::CookieMonster* cookie_store_; |
| 76 net::CookiePolicy cookie_policy_; | 84 net::CookiePolicy cookie_policy_; |
| 77 net::FtpAuthCache ftp_auth_cache_; | 85 net::FtpAuthCache ftp_auth_cache_; |
| 78 std::string accept_language_; | 86 std::string accept_language_; |
| 79 std::string accept_charset_; | 87 std::string accept_charset_; |
| 80 | 88 |
| 81 private: | 89 private: |
| 82 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 90 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
| 83 }; | 91 }; |
| 84 | 92 |
| 85 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 93 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |