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