OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 return ftp_auth_cache_.get(); | 171 return ftp_auth_cache_.get(); |
172 #else | 172 #else |
173 return NULL; | 173 return NULL; |
174 #endif | 174 #endif |
175 } | 175 } |
176 | 176 |
177 // --------------------------------------------------------------------------- | 177 // --------------------------------------------------------------------------- |
178 // Legacy accessors that delegate to http_user_agent_settings_. | 178 // Legacy accessors that delegate to http_user_agent_settings_. |
179 // TODO(pauljensen): Remove after all clients are updated to directly access | 179 // TODO(pauljensen): Remove after all clients are updated to directly access |
180 // http_user_agent_settings_. | 180 // http_user_agent_settings_. |
181 // Gets the value of 'Accept-Charset' header field. | |
182 std::string GetAcceptCharset() const; | |
183 // Gets the value of 'Accept-Language' header field. | 181 // Gets the value of 'Accept-Language' header field. |
184 std::string GetAcceptLanguage() const; | 182 std::string GetAcceptLanguage() const; |
185 // Gets the UA string to use for the given URL. Pass an invalid URL (such as | 183 // Gets the UA string to use for the given URL. Pass an invalid URL (such as |
186 // GURL()) to get the default UA string. | 184 // GURL()) to get the default UA string. |
187 std::string GetUserAgent(const GURL& url) const; | 185 std::string GetUserAgent(const GURL& url) const; |
188 // --------------------------------------------------------------------------- | 186 // --------------------------------------------------------------------------- |
189 | 187 |
190 const URLRequestJobFactory* job_factory() const { return job_factory_; } | 188 const URLRequestJobFactory* job_factory() const { return job_factory_; } |
191 void set_job_factory(const URLRequestJobFactory* job_factory) { | 189 void set_job_factory(const URLRequestJobFactory* job_factory) { |
192 job_factory_ = job_factory; | 190 job_factory_ = job_factory; |
193 } | 191 } |
194 | 192 |
195 // May be NULL. | 193 // May be NULL. |
196 URLRequestThrottlerManager* throttler_manager() const { | 194 URLRequestThrottlerManager* throttler_manager() const { |
197 return throttler_manager_; | 195 return throttler_manager_; |
198 } | 196 } |
199 void set_throttler_manager(URLRequestThrottlerManager* throttler_manager) { | 197 void set_throttler_manager(URLRequestThrottlerManager* throttler_manager) { |
200 throttler_manager_ = throttler_manager; | 198 throttler_manager_ = throttler_manager; |
201 } | 199 } |
202 | 200 |
203 // Gets the URLRequest objects that hold a reference to this | 201 // Gets the URLRequest objects that hold a reference to this |
204 // URLRequestContext. | 202 // URLRequestContext. |
205 std::set<const URLRequest*>* url_requests() const { | 203 std::set<const URLRequest*>* url_requests() const { |
206 return url_requests_.get(); | 204 return url_requests_.get(); |
207 } | 205 } |
208 | 206 |
209 void AssertNoURLRequests() const; | 207 void AssertNoURLRequests() const; |
210 | 208 |
211 // Get the underlying |HttpUserAgentSettings| implementation that provides | 209 // Get the underlying |HttpUserAgentSettings| implementation that provides |
212 // the HTTP Accept-Language, Accept-Charset and User-Agent header values. | 210 // the HTTP Accept-Language and User-Agent header values. |
213 const HttpUserAgentSettings* http_user_agent_settings() const { | 211 const HttpUserAgentSettings* http_user_agent_settings() const { |
214 return http_user_agent_settings_; | 212 return http_user_agent_settings_; |
215 } | 213 } |
216 void set_http_user_agent_settings( | 214 void set_http_user_agent_settings( |
217 HttpUserAgentSettings* http_user_agent_settings) { | 215 HttpUserAgentSettings* http_user_agent_settings) { |
218 http_user_agent_settings_ = http_user_agent_settings; | 216 http_user_agent_settings_ = http_user_agent_settings; |
219 } | 217 } |
220 | 218 |
221 private: | 219 private: |
222 // --------------------------------------------------------------------------- | 220 // --------------------------------------------------------------------------- |
(...skipping 30 matching lines...) Expand all Loading... |
253 // --------------------------------------------------------------------------- | 251 // --------------------------------------------------------------------------- |
254 | 252 |
255 scoped_ptr<std::set<const URLRequest*> > url_requests_; | 253 scoped_ptr<std::set<const URLRequest*> > url_requests_; |
256 | 254 |
257 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 255 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
258 }; | 256 }; |
259 | 257 |
260 } // namespace net | 258 } // namespace net |
261 | 259 |
262 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 260 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
OLD | NEW |