Chromium Code Reviews| Index: net/url_request/url_request_context.h |
| diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h |
| index cea9de5b1a657d2631d5a8e7f99a957500ef3a1d..78bd35edc5044dc21b2e999d5f5be7059cb741b4 100644 |
| --- a/net/url_request/url_request_context.h |
| +++ b/net/url_request/url_request_context.h |
| @@ -33,6 +33,7 @@ class FtpTransactionFactory; |
| class HostResolver; |
| class HttpAuthHandlerFactory; |
| class HttpTransactionFactory; |
| +class HttpUserAgentSettings; |
| class NetworkDelegate; |
| class ServerBoundCertService; |
| class ProxyService; |
| @@ -172,22 +173,18 @@ class NET_EXPORT URLRequestContext |
| #endif |
| } |
| + // --------------------------------------------------------------------------- |
| + // Legacy accessors that delegate to http_user_agent_settings_. |
| + // TODO(pauljensen): Remove after all clients are updated to directly access |
| + // http_user_agent_settings_. |
| // Gets the value of 'Accept-Charset' header field. |
| - const std::string& accept_charset() const { return accept_charset_; } |
| - void set_accept_charset(const std::string& accept_charset) { |
| - accept_charset_ = accept_charset; |
| - } |
| - |
| + const std::string& accept_charset() const; |
| // Gets the value of 'Accept-Language' header field. |
| - const std::string& accept_language() const { return accept_language_; } |
| - void set_accept_language(const std::string& accept_language) { |
| - accept_language_ = accept_language; |
| - } |
| - |
| + const std::string& accept_language() const; |
| // Gets the UA string to use for the given URL. Pass an invalid URL (such as |
| - // GURL()) to get the default UA string. Subclasses should override this |
| - // method to provide a UA string. |
| - virtual const std::string& GetUserAgent(const GURL& url) const; |
| + // GURL()) to get the default UA string. |
| + const std::string& GetUserAgent(const GURL& url) const; |
| + // --------------------------------------------------------------------------- |
| // In general, referrer_charset is not known when URLRequestContext is |
| // constructed. So, we need a setter. |
| @@ -217,6 +214,13 @@ class NET_EXPORT URLRequestContext |
| void AssertNoURLRequests() const; |
| + // Set the underlying |HttpUserAgentSettings| implementation that provides |
| + // the HTTP Accept-Language, Accept-Charset and User-Agent header values. |
| + void set_http_user_agent_settings( |
| + HttpUserAgentSettings* http_user_agent_settings) { |
| + http_user_agent_settings_ = http_user_agent_settings; |
|
mmenke
2012/09/26 16:28:20
nit: Fix indent. HttpUserAgentSettings* should b
|
| + } |
| + |
| private: |
| // --------------------------------------------------------------------------- |
| // Important: When adding any new members below, consider whether they need to |
| @@ -240,8 +244,6 @@ class NET_EXPORT URLRequestContext |
| #if !defined(DISABLE_FTP_SUPPORT) |
| scoped_ptr<FtpAuthCache> ftp_auth_cache_; |
| #endif |
| - std::string accept_language_; |
| - std::string accept_charset_; |
| // The charset of the referrer where this request comes from. It's not |
| // used in communication with a server but is used to construct a suggested |
| // filename for file download. |
| @@ -250,6 +252,7 @@ class NET_EXPORT URLRequestContext |
| FtpTransactionFactory* ftp_transaction_factory_; |
| const URLRequestJobFactory* job_factory_; |
| URLRequestThrottlerManager* throttler_manager_; |
| + HttpUserAgentSettings* http_user_agent_settings_; |
| // --------------------------------------------------------------------------- |
| // Important: When adding any new members below, consider whether they need to |