Chromium Code Reviews| Index: chrome/browser/io_thread.cc |
| diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc |
| index 700ff2cd3c7f85d228bd028e89b7724cb837f917..5b93073745ce43c7b84521db8445670495941fdb 100644 |
| --- a/chrome/browser/io_thread.cc |
| +++ b/chrome/browser/io_thread.cc |
| @@ -15,7 +15,11 @@ |
| #include "base/string_split.h" |
| #include "base/string_util.h" |
| #include "base/threading/thread_restrictions.h" |
| +#include "chrome/browser/browser_process.h" |
| #include "chrome/browser/browser_thread.h" |
| +#if defined(OS_CHROMEOS) |
| +#include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| +#endif // defined(OS_CHROMEOS) |
| #include "chrome/browser/gpu_process_host.h" |
| #include "chrome/browser/in_process_webkit/indexed_db_key_utility_client.h" |
| #include "chrome/browser/net/chrome_net_log.h" |
| @@ -23,6 +27,7 @@ |
| #include "chrome/browser/net/connect_interceptor.h" |
| #include "chrome/browser/net/passive_log_collector.h" |
| #include "chrome/browser/net/predictor_api.h" |
| +#include "chrome/browser/net/pref_proxy_config_service.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/net/raw_host_resolver_proc.h" |
| @@ -35,6 +40,7 @@ |
| #include "net/base/host_resolver_impl.h" |
| #include "net/base/mapped_host_resolver.h" |
| #include "net/base/net_util.h" |
| +#include "net/proxy/proxy_config_service_fixed.h" |
| #include "net/http/http_auth_filter.h" |
| #include "net/http/http_auth_handler_factory.h" |
| #include "net/http/http_network_layer.h" |
| @@ -195,6 +201,24 @@ ConstructProxyScriptFetcherContext(IOThread::Globals* globals, |
| return context; |
| } |
| +scoped_refptr<net::URLRequestContext> |
| +ConstructSystemRequestContext(IOThread::Globals* globals, |
| + net::NetLog* net_log) { |
| + scoped_refptr<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()); |
| + context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); |
| + context->set_http_auth_handler_factory( |
| + globals->http_auth_handler_factory.get()); |
| + context->set_proxy_service(globals->system_proxy_service.get()); |
| + context->set_http_transaction_factory( |
| + globals->system_http_transaction_factory.get()); |
| + // In-memory cookie store. |
| + context->set_cookie_store(new net::CookieMonster(NULL, NULL)); |
| + return context; |
| +} |
| + |
| } // namespace |
| // The IOThread object must outlive any tasks posted to the IO thread before the |
| @@ -243,6 +267,44 @@ ChromeNetLog* IOThread::net_log() { |
| return net_log_; |
| } |
| +void IOThread::InitSystemRequestContext( |
| + net::ProxyConfigService* config_service) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + message_loop()->PostTask( |
| + FROM_HERE, |
| + NewRunnableMethod( |
| + this, |
| + &IOThread::InitSystemRequestContextOnIOThread, |
| + config_service)); |
| +} |
| + |
| +void IOThread::InitSystemRequestContextOnIOThread( |
| + net::ProxyConfigService* config_service) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| + |
| + size_t num_pac_threads = 0u; // Use default number of threads. |
| + globals_->system_proxy_service = |
|
willchan no longer on Chromium
2011/02/08 22:52:04
I think this code when I wrote it was a bit off. W
battre
2011/02/14 18:22:05
I don't see a code path that could instantiate a V
willchan no longer on Chromium
2011/02/15 01:05:58
Yes. Perhaps you could refactor them both to share
|
| + net::ProxyService::CreateUsingSystemProxyResolver( |
| + config_service, num_pac_threads, net_log_); |
| + net::HttpNetworkSession::Params system_params; |
| + system_params.host_resolver = globals_->host_resolver.get(); |
| + system_params.cert_verifier = globals_->cert_verifier.get(); |
| + system_params.dnsrr_resolver = globals_->dnsrr_resolver.get(); |
| + system_params.dns_cert_checker = NULL; |
| + system_params.ssl_host_info_factory = NULL; |
| + system_params.proxy_service = globals_->system_proxy_service.get(); |
| + system_params.ssl_config_service = globals_->ssl_config_service.get(); |
| + system_params.http_auth_handler_factory = |
| + globals_->http_auth_handler_factory.get(); |
| + system_params.network_delegate = &globals_->network_delegate; |
| + system_params.net_log = net_log_; |
| + globals_->system_http_transaction_factory.reset( |
| + new net::HttpNetworkLayer( |
| + new net::HttpNetworkSession(system_params))); |
| + globals_->system_request_context = |
| + ConstructSystemRequestContext(globals_, net_log_); |
| +} |
| + |
| void IOThread::InitNetworkPredictor( |
| bool prefetching_enabled, |
| base::TimeDelta max_dns_queue_delay, |