diff options
author | pauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 15:08:43 +0000 |
---|---|---|
committer | pauljensen@chromium.org <pauljensen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-07 15:08:43 +0000 |
commit | ee4c30d8c5fca53a990da472de17314de366341b (patch) | |
tree | bc52b41397e143b46d0673991a13052edb1c9c66 /chrome/service | |
parent | 91d4f2541624923604d54fdf280483a08a393464 (diff) | |
download | chromium_src-ee4c30d8c5fca53a990da472de17314de366341b.zip chromium_src-ee4c30d8c5fca53a990da472de17314de366341b.tar.gz chromium_src-ee4c30d8c5fca53a990da472de17314de366341b.tar.bz2 |
Provide mutable members of UrlRequestContext via pure-virtual interface. Create a pure-virtual interface called HttpUserAgentSettings that provides access to the Accept-Language, Accept-Charset, and User-Agent HTTP headers. Each UrlRequestContext should have a HttpUserAgentSettings implementation attached via set_http_user_agent_settings().
BUG=146596
Review URL: https://chromiumcodereview.appspot.com/10918279
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166425 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/net/service_url_request_context.cc | 16 | ||||
-rw-r--r-- | chrome/service/net/service_url_request_context.h | 4 |
2 files changed, 4 insertions, 16 deletions
diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc index e05b7b9..3bb5565 100644 --- a/chrome/service/net/service_url_request_context.cc +++ b/chrome/service/net/service_url_request_context.cc @@ -25,6 +25,7 @@ #include "net/http/http_server_properties_impl.h" #include "net/proxy/proxy_config_service.h" #include "net/proxy/proxy_service.h" +#include "net/url_request/static_http_user_agent_settings.h" #include "net/url_request/url_request_throttler_manager.h" namespace { @@ -108,8 +109,7 @@ std::string MakeUserAgentForServiceProcess() { ServiceURLRequestContext::ServiceURLRequestContext( const std::string& user_agent, net::ProxyConfigService* net_proxy_config_service) - : user_agent_(user_agent), - ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { + : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { storage_.set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL)); storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( net_proxy_config_service, 0u, NULL)); @@ -138,16 +138,8 @@ ServiceURLRequestContext::ServiceURLRequestContext( net::HttpCache::DefaultBackend::InMemory(0))); // In-memory cookie store. storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); - set_accept_language("en-us,fr"); - set_accept_charset("iso-8859-1,*,utf-8"); -} - -const std::string& ServiceURLRequestContext::GetUserAgent( - const GURL& url) const { - // If the user agent is set explicitly return that, otherwise call the - // base class method to return default value. - return user_agent_.empty() ? - net::URLRequestContext::GetUserAgent(url) : user_agent_; + storage_.set_http_user_agent_settings(new net::StaticHttpUserAgentSettings( + "en-us,fr", "iso-8859-1,*,utf-8", user_agent)); } ServiceURLRequestContext::~ServiceURLRequestContext() { diff --git a/chrome/service/net/service_url_request_context.h b/chrome/service/net/service_url_request_context.h index 6fa2429..aa06778 100644 --- a/chrome/service/net/service_url_request_context.h +++ b/chrome/service/net/service_url_request_context.h @@ -41,11 +41,7 @@ class ServiceURLRequestContext : public net::URLRequestContext { virtual ~ServiceURLRequestContext(); - // Overridden from net::URLRequestContext: - virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE; - private: - std::string user_agent_; net::URLRequestContextStorage storage_; }; |