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_ |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Gets the value of 'Accept-Language' header field. | 63 // Gets the value of 'Accept-Language' header field. |
64 const std::string& accept_language() const { return accept_language_; } | 64 const std::string& accept_language() const { return accept_language_; } |
65 | 65 |
66 // Gets the UA string to use for the given URL. Pass an invalid URL (such as | 66 // Gets the UA string to use for the given URL. Pass an invalid URL (such as |
67 // GURL()) to get the default UA string. Subclasses should override this | 67 // GURL()) to get the default UA string. Subclasses should override this |
68 // method to provide a UA string. | 68 // method to provide a UA string. |
69 virtual const std::string& GetUserAgent(const GURL& url) const { | 69 virtual const std::string& GetUserAgent(const GURL& url) const { |
70 return EmptyString(); | 70 return EmptyString(); |
71 } | 71 } |
72 | 72 |
| 73 // In general, referrer_charset is not known when URLRequestContext is |
| 74 // constructed. So, we need a setter. |
| 75 const std::string& referrer_charset() const { return referrer_charset_; } |
| 76 void set_referrer_charset(const std::string& charset) { |
| 77 referrer_charset_ = charset; |
| 78 } |
| 79 |
73 protected: | 80 protected: |
74 friend class base::RefCountedThreadSafe<URLRequestContext>; | 81 friend class base::RefCountedThreadSafe<URLRequestContext>; |
75 | 82 |
76 virtual ~URLRequestContext() {} | 83 virtual ~URLRequestContext() {} |
77 | 84 |
78 // The following members are expected to be initialized and owned by | 85 // The following members are expected to be initialized and owned by |
79 // subclasses. | 86 // subclasses. |
80 net::ProxyService* proxy_service_; | 87 net::ProxyService* proxy_service_; |
81 net::HttpTransactionFactory* http_transaction_factory_; | 88 net::HttpTransactionFactory* http_transaction_factory_; |
82 net::FtpTransactionFactory* ftp_transaction_factory_; | 89 net::FtpTransactionFactory* ftp_transaction_factory_; |
83 net::CookieMonster* cookie_store_; | 90 net::CookieMonster* cookie_store_; |
84 net::CookiePolicy cookie_policy_; | 91 net::CookiePolicy cookie_policy_; |
85 net::FtpAuthCache ftp_auth_cache_; | 92 net::FtpAuthCache ftp_auth_cache_; |
86 std::string accept_language_; | 93 std::string accept_language_; |
87 std::string accept_charset_; | 94 std::string accept_charset_; |
| 95 // The charset of the referrer where this request comes from. It's not |
| 96 // used in communication with a server but is used to construct a suggested |
| 97 // filename for file download. |
| 98 std::string referrer_charset_; |
88 | 99 |
89 private: | 100 private: |
90 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 101 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
91 }; | 102 }; |
92 | 103 |
93 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 104 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |