OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // method to provide a UA string. | 102 // method to provide a UA string. |
103 virtual const std::string& GetUserAgent(const GURL& url) const; | 103 virtual const std::string& GetUserAgent(const GURL& url) const; |
104 | 104 |
105 // In general, referrer_charset is not known when URLRequestContext is | 105 // In general, referrer_charset is not known when URLRequestContext is |
106 // constructed. So, we need a setter. | 106 // constructed. So, we need a setter. |
107 const std::string& referrer_charset() const { return referrer_charset_; } | 107 const std::string& referrer_charset() const { return referrer_charset_; } |
108 void set_referrer_charset(const std::string& charset) { | 108 void set_referrer_charset(const std::string& charset) { |
109 referrer_charset_ = charset; | 109 referrer_charset_ = charset; |
110 } | 110 } |
111 | 111 |
| 112 // Controls whether or not the URLRequestContext considers itself to be the |
| 113 // "main" URLRequestContext. |
| 114 bool is_main() const { return is_main_; } |
| 115 void set_is_main(bool is_main) { is_main_ = is_main; } |
| 116 |
112 protected: | 117 protected: |
113 friend class base::RefCountedThreadSafe<URLRequestContext>; | 118 friend class base::RefCountedThreadSafe<URLRequestContext>; |
114 | 119 |
115 virtual ~URLRequestContext(); | 120 virtual ~URLRequestContext(); |
116 | 121 |
117 // The following members are expected to be initialized and owned by | 122 // The following members are expected to be initialized and owned by |
118 // subclasses. | 123 // subclasses. |
119 net::NetLog* net_log_; | 124 net::NetLog* net_log_; |
120 net::HostResolver* host_resolver_; | 125 net::HostResolver* host_resolver_; |
121 net::DnsRRResolver* dnsrr_resolver_; | 126 net::DnsRRResolver* dnsrr_resolver_; |
122 scoped_refptr<net::ProxyService> proxy_service_; | 127 scoped_refptr<net::ProxyService> proxy_service_; |
123 scoped_refptr<net::SSLConfigService> ssl_config_service_; | 128 scoped_refptr<net::SSLConfigService> ssl_config_service_; |
124 net::HttpTransactionFactory* http_transaction_factory_; | 129 net::HttpTransactionFactory* http_transaction_factory_; |
125 net::FtpTransactionFactory* ftp_transaction_factory_; | 130 net::FtpTransactionFactory* ftp_transaction_factory_; |
126 net::HttpAuthHandlerFactory* http_auth_handler_factory_; | 131 net::HttpAuthHandlerFactory* http_auth_handler_factory_; |
127 net::HttpNetworkDelegate* network_delegate_; | 132 net::HttpNetworkDelegate* network_delegate_; |
128 scoped_refptr<net::CookieStore> cookie_store_; | 133 scoped_refptr<net::CookieStore> cookie_store_; |
129 net::CookiePolicy* cookie_policy_; | 134 net::CookiePolicy* cookie_policy_; |
130 scoped_refptr<net::TransportSecurityState> transport_security_state_; | 135 scoped_refptr<net::TransportSecurityState> transport_security_state_; |
131 net::FtpAuthCache ftp_auth_cache_; | 136 net::FtpAuthCache ftp_auth_cache_; |
132 std::string accept_language_; | 137 std::string accept_language_; |
133 std::string accept_charset_; | 138 std::string accept_charset_; |
134 // The charset of the referrer where this request comes from. It's not | 139 // The charset of the referrer where this request comes from. It's not |
135 // used in communication with a server but is used to construct a suggested | 140 // used in communication with a server but is used to construct a suggested |
136 // filename for file download. | 141 // filename for file download. |
137 std::string referrer_charset_; | 142 std::string referrer_charset_; |
138 | 143 |
139 private: | 144 private: |
| 145 // Indicates whether or not this is the main URLRequestContext. |
| 146 bool is_main_; |
| 147 |
140 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 148 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
141 }; | 149 }; |
142 | 150 |
143 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 151 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |