Chromium Code Reviews| Index: chrome/browser/io_thread.cc |
| diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc |
| index 491f4febe020bb68f43c61c30b7a4ae595ede63f..cfe55edaa0e77d3f6d9740a509d60de9fceb3ea9 100644 |
| --- a/chrome/browser/io_thread.cc |
| +++ b/chrome/browser/io_thread.cc |
| @@ -22,6 +22,7 @@ |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/extensions/event_router_forwarder.h" |
| #include "chrome/browser/net/async_dns_field_trial.h" |
| +#include "chrome/browser/net/basic_http_user_agent_settings.h" |
| #include "chrome/browser/net/chrome_net_log.h" |
| #include "chrome/browser/net/chrome_network_delegate.h" |
| #include "chrome/browser/net/chrome_url_request_context.h" |
| @@ -75,24 +76,10 @@ class SafeBrowsingURLRequestContext; |
| namespace { |
| -// Custom URLRequestContext used by requests which aren't associated with a |
| -// particular profile. We need to use a subclass of URLRequestContext in order |
| -// to provide the correct User-Agent. |
| -class URLRequestContextWithUserAgent : public net::URLRequestContext { |
| - public: |
| - virtual const std::string& GetUserAgent( |
| - const GURL& url) const OVERRIDE { |
| - return content::GetUserAgent(url); |
| - } |
| - |
| - protected: |
| - virtual ~URLRequestContextWithUserAgent() {} |
| -}; |
| - |
| // Used for the "system" URLRequestContext. If this grows more complicated, then |
|
erikwright (departed)
2012/09/25 21:06:38
Comment from "If this grows..." is no longer relev
|
| // consider inheriting directly from URLRequestContext rather than using |
| // implementation inheritance. |
| -class SystemURLRequestContext : public URLRequestContextWithUserAgent { |
| +class SystemURLRequestContext : public net::URLRequestContext { |
| public: |
| SystemURLRequestContext() { |
| #if defined(USE_NSS) |
| @@ -195,7 +182,7 @@ net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { |
| net::URLRequestContext* |
| ConstructProxyScriptFetcherContext(IOThread::Globals* globals, |
| net::NetLog* net_log) { |
| - net::URLRequestContext* context = new URLRequestContextWithUserAgent; |
| + net::URLRequestContext* context = new net::URLRequestContext; |
| context->set_net_log(net_log); |
| context->set_host_resolver(globals->host_resolver.get()); |
| context->set_cert_verifier(globals->cert_verifier.get()); |
| @@ -212,6 +199,8 @@ ConstructProxyScriptFetcherContext(IOThread::Globals* globals, |
| context->set_server_bound_cert_service( |
| globals->system_server_bound_cert_service.get()); |
| context->set_network_delegate(globals->system_network_delegate.get()); |
| + context->set_http_user_agent_settings( |
| + globals->basic_http_user_agent_settings.get()); |
| // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| // system URLRequestContext too. There's no reason this should be tied to a |
| // profile. |
| @@ -239,6 +228,8 @@ ConstructSystemRequestContext(IOThread::Globals* globals, |
| globals->system_server_bound_cert_service.get()); |
| context->set_throttler_manager(globals->throttler_manager.get()); |
| context->set_network_delegate(globals->system_network_delegate.get()); |
| + context->set_http_user_agent_settings( |
| + globals->basic_http_user_agent_settings.get()); |
| return context; |
| } |
| @@ -458,6 +449,8 @@ void IOThread::Init() { |
| base::WorkerPool::GetTaskRunner(true))); |
| globals_->load_time_stats.reset(new chrome_browser_net::LoadTimeStats()); |
| globals_->host_mapping_rules.reset(new net::HostMappingRules()); |
| + globals_->basic_http_user_agent_settings.reset( |
| + new BasicHttpUserAgentSettings(EmptyString(), EmptyString())); |
| if (command_line.HasSwitch(switches::kHostRules)) { |
| globals_->host_mapping_rules->SetRulesFromString( |
| command_line.GetSwitchValueASCII(switches::kHostRules)); |