blob: a8286c6e10841cc58b5bbefa863729a58e4b6157 [file] [log] [blame]
[email protected]d24fc3a02012-02-11 02:08:341// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]0ac83682010-01-22 17:46:272// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/io_thread.h"
[email protected]e83326f2010-07-31 17:29:256
[email protected]bcefe0f2010-11-10 16:19:107#include <vector>
8
[email protected]21ee224e2011-11-21 02:17:539#include "base/bind.h"
10#include "base/bind_helpers.h"
[email protected]aa84a7e2012-03-15 21:29:0611#include "base/command_line.h"
[email protected]c93123fa2012-04-19 02:49:4812#include "base/compiler_specific.h"
[email protected]58580352010-10-26 04:07:5013#include "base/debug/leak_tracker.h"
[email protected]0ac83682010-01-22 17:46:2714#include "base/logging.h"
[email protected]7286e3fc2011-07-19 22:13:2415#include "base/stl_util.h"
[email protected]e83326f2010-07-31 17:29:2516#include "base/string_number_conversions.h"
[email protected]4e5ae20f2010-09-24 04:52:1117#include "base/string_split.h"
[email protected]f1d81922010-07-31 17:47:0918#include "base/string_util.h"
[email protected]3fc40c142011-12-01 13:09:0419#include "base/threading/thread.h"
[email protected]5bab49ec2012-05-04 21:13:1920#include "base/threading/worker_pool.h"
[email protected]addb3242011-06-13 21:39:1621#include "build/build_config.h"
[email protected]df2840d2011-02-20 16:32:3222#include "chrome/browser/browser_process.h"
[email protected]5a38dfd2012-07-23 23:22:1023#include "chrome/browser/extensions/event_router_forwarder.h"
[email protected]026876f32012-08-22 23:53:4024#include "chrome/browser/net/async_dns_field_trial.h"
[email protected]9e743cd2010-03-16 07:03:5325#include "chrome/browser/net/chrome_net_log.h"
[email protected]c38831a12011-10-28 12:44:4926#include "chrome/browser/net/chrome_network_delegate.h"
[email protected]0ee7a3b2010-11-09 06:13:4027#include "chrome/browser/net/chrome_url_request_context.h"
[email protected]1889dc1b2010-10-14 22:03:1328#include "chrome/browser/net/connect_interceptor.h"
[email protected]7613faae2012-04-18 01:01:1929#include "chrome/browser/net/http_pipelining_compatibility_client.h"
[email protected]a9e0d1412012-08-20 22:13:0130#include "chrome/browser/net/load_time_stats.h"
[email protected]6f96cbcb2011-11-04 02:26:0731#include "chrome/browser/net/pref_proxy_config_tracker.h"
[email protected]db0e86dd2011-03-16 14:47:2132#include "chrome/browser/net/proxy_service_factory.h"
[email protected]3b543ab2011-09-17 21:47:0033#include "chrome/browser/net/sdch_dictionary_fetcher.h"
[email protected]ec44ee02012-09-28 21:31:5134#include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h"
[email protected]bcefe0f2010-11-10 16:19:1035#include "chrome/browser/prefs/pref_service.h"
[email protected]0ac83682010-01-22 17:46:2736#include "chrome/common/chrome_switches.h"
[email protected]bcefe0f2010-11-10 16:19:1037#include "chrome/common/pref_names.h"
[email protected]c38831a12011-10-28 12:44:4938#include "content/public/browser/browser_thread.h"
[email protected]5d1fa242011-10-18 23:35:3839#include "content/public/common/content_client.h"
[email protected]822581d2010-12-16 17:27:1540#include "net/base/cert_verifier.h"
[email protected]32cb7fb2012-03-22 22:41:1141#include "net/base/default_server_bound_cert_store.h"
[email protected]0ac83682010-01-22 17:46:2742#include "net/base/host_cache.h"
[email protected]c2dad292012-09-07 21:27:3543#include "net/base/host_mapping_rules.h"
[email protected]0ac83682010-01-22 17:46:2744#include "net/base/host_resolver.h"
[email protected]86933612010-10-16 23:10:3345#include "net/base/mapped_host_resolver.h"
[email protected]32eaa332010-02-08 22:15:5446#include "net/base/net_util.h"
[email protected]3b543ab2011-09-17 21:47:0047#include "net/base/sdch_manager.h"
[email protected]32cb7fb2012-03-22 22:41:1148#include "net/base/server_bound_cert_service.h"
[email protected]aa84a7e2012-03-15 21:29:0649#include "net/cookies/cookie_monster.h"
[email protected]933bc5c62011-04-12 19:08:0250#include "net/ftp/ftp_network_layer.h"
[email protected]eb3cac72010-02-26 21:07:4551#include "net/http/http_auth_filter.h"
[email protected]fa55e192010-02-15 14:25:5052#include "net/http/http_auth_handler_factory.h"
[email protected]2fb629202010-12-23 23:52:5753#include "net/http/http_network_layer.h"
[email protected]57cb0f72011-01-28 06:33:5854#include "net/http/http_network_session.h"
[email protected]17291a022011-10-10 07:32:5355#include "net/http/http_server_properties_impl.h"
[email protected]6104ea5d2011-04-27 21:37:1256#include "net/proxy/proxy_config_service.h"
[email protected]86933612010-10-16 23:10:3357#include "net/proxy/proxy_script_fetcher_impl.h"
[email protected]6104ea5d2011-04-27 21:37:1258#include "net/proxy/proxy_service.h"
[email protected]3dc1bc42012-06-19 08:20:5359#include "net/url_request/url_fetcher.h"
[email protected]a73a2802012-05-02 19:20:1560#include "net/url_request/url_request_throttler_manager.h"
[email protected]0ac83682010-01-22 17:46:2761
[email protected]77feb462011-05-16 23:37:2562#if defined(USE_NSS)
63#include "net/ocsp/nss_ocsp.h"
64#endif // defined(USE_NSS)
65
[email protected]6f96cbcb2011-11-04 02:26:0766#if defined(OS_CHROMEOS)
67#include "chrome/browser/chromeos/proxy_config_service_impl.h"
68#endif // defined(OS_CHROMEOS)
69
[email protected]631bb742011-11-02 11:29:3970using content::BrowserThread;
71
[email protected]075c0322012-02-14 00:56:4472class SafeBrowsingURLRequestContext;
73
[email protected]21ee224e2011-11-21 02:17:5374// The IOThread object must outlive any tasks posted to the IO thread before the
75// Quit task, so base::Bind() calls are not refcounted.
76
[email protected]0ac83682010-01-22 17:46:2777namespace {
78
[email protected]11f5e3a2012-09-27 00:30:1379#if defined(OS_MACOSX) && !defined(OS_IOS)
80void ObserveKeychainEvents() {
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
82 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents();
83}
84#endif
85
[email protected]bd0875e2011-03-25 05:13:3586// Custom URLRequestContext used by requests which aren't associated with a
87// particular profile. We need to use a subclass of URLRequestContext in order
88// to provide the correct User-Agent.
89class URLRequestContextWithUserAgent : public net::URLRequestContext {
90 public:
91 virtual const std::string& GetUserAgent(
92 const GURL& url) const OVERRIDE {
[email protected]b75520232011-10-12 23:45:2593 return content::GetUserAgent(url);
[email protected]bd0875e2011-03-25 05:13:3594 }
[email protected]649d1c02012-04-27 02:56:2195
96 protected:
97 virtual ~URLRequestContextWithUserAgent() {}
[email protected]bd0875e2011-03-25 05:13:3598};
99
[email protected]77feb462011-05-16 23:37:25100// Used for the "system" URLRequestContext. If this grows more complicated, then
101// consider inheriting directly from URLRequestContext rather than using
102// implementation inheritance.
103class SystemURLRequestContext : public URLRequestContextWithUserAgent {
104 public:
105 SystemURLRequestContext() {
106#if defined(USE_NSS)
[email protected]8c434cbc2012-03-14 14:25:09107 net::SetURLRequestContextForNSSHttpIO(this);
[email protected]77feb462011-05-16 23:37:25108#endif // defined(USE_NSS)
109 }
110
111 private:
112 virtual ~SystemURLRequestContext() {
113#if defined(USE_NSS)
[email protected]8c434cbc2012-03-14 14:25:09114 net::SetURLRequestContextForNSSHttpIO(NULL);
[email protected]77feb462011-05-16 23:37:25115#endif // defined(USE_NSS)
116 }
117};
118
[email protected]c54a8912012-10-22 22:09:43119scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) {
[email protected]0ac83682010-01-22 17:46:27120 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
[email protected]962b98212010-07-17 03:37:51121
[email protected]026876f32012-08-22 23:53:40122 bool allow_async_dns_field_trial = true;
123
[email protected]c54a8912012-10-22 22:09:43124 net::HostResolver::Options options;
[email protected]962b98212010-07-17 03:37:51125
126 // Use the concurrency override from the command-line, if any.
127 if (command_line.HasSwitch(switches::kHostResolverParallelism)) {
[email protected]026876f32012-08-22 23:53:40128 allow_async_dns_field_trial = false;
[email protected]962b98212010-07-17 03:37:51129 std::string s =
130 command_line.GetSwitchValueASCII(switches::kHostResolverParallelism);
131
132 // Parse the switch (it should be a positive integer formatted as decimal).
133 int n;
[email protected]e83326f2010-07-31 17:29:25134 if (base::StringToInt(s, &n) && n > 0) {
[email protected]c54a8912012-10-22 22:09:43135 options.max_concurrent_resolves = static_cast<size_t>(n);
[email protected]962b98212010-07-17 03:37:51136 } else {
137 LOG(ERROR) << "Invalid switch for host resolver parallelism: " << s;
138 }
139 }
140
[email protected]06ef6d92011-05-19 04:24:58141 // Use the retry attempts override from the command-line, if any.
142 if (command_line.HasSwitch(switches::kHostResolverRetryAttempts)) {
[email protected]026876f32012-08-22 23:53:40143 allow_async_dns_field_trial = false;
[email protected]06ef6d92011-05-19 04:24:58144 std::string s =
145 command_line.GetSwitchValueASCII(switches::kHostResolverRetryAttempts);
146 // Parse the switch (it should be a non-negative integer).
147 int n;
148 if (base::StringToInt(s, &n) && n >= 0) {
[email protected]c54a8912012-10-22 22:09:43149 options.max_retry_attempts = static_cast<size_t>(n);
[email protected]06ef6d92011-05-19 04:24:58150 } else {
151 LOG(ERROR) << "Invalid switch for host resolver retry attempts: " << s;
152 }
153 }
154
[email protected]b3601bc22012-02-21 21:23:20155 if (command_line.HasSwitch(switches::kEnableAsyncDns)) {
[email protected]026876f32012-08-22 23:53:40156 allow_async_dns_field_trial = false;
[email protected]c54a8912012-10-22 22:09:43157 options.enable_async = true;
[email protected]026876f32012-08-22 23:53:40158 } else if (command_line.HasSwitch(switches::kDisableAsyncDns)) {
159 allow_async_dns_field_trial = false;
[email protected]c54a8912012-10-22 22:09:43160 options.enable_async = false;
[email protected]d987cca2011-07-21 12:54:37161 }
162
[email protected]026876f32012-08-22 23:53:40163 if (allow_async_dns_field_trial)
[email protected]c54a8912012-10-22 22:09:43164 options.enable_async = chrome_browser_net::ConfigureAsyncDnsFieldTrial();
[email protected]026876f32012-08-22 23:53:40165
[email protected]c54a8912012-10-22 22:09:43166 scoped_ptr<net::HostResolver> global_host_resolver(
167 net::HostResolver::CreateSystemResolver(options, net_log));
[email protected]9087aa32010-02-18 08:03:38168
[email protected]0f8f1b432010-03-16 19:06:03169 // Determine if we should disable IPv6 support.
[email protected]9087aa32010-02-18 08:03:38170 if (!command_line.HasSwitch(switches::kEnableIPv6)) {
[email protected]0f8f1b432010-03-16 19:06:03171 if (command_line.HasSwitch(switches::kDisableIPv6)) {
[email protected]46f6e202010-02-26 06:07:25172 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4);
[email protected]0f8f1b432010-03-16 19:06:03173 } else {
[email protected]a78f4272011-10-21 19:16:33174 global_host_resolver->ProbeIPv6Support();
[email protected]0f8f1b432010-03-16 19:06:03175 }
[email protected]9087aa32010-02-18 08:03:38176 }
177
[email protected]9087aa32010-02-18 08:03:38178 // If hostname remappings were specified on the command-line, layer these
179 // rules on top of the real host resolver. This allows forwarding all requests
180 // through a designated test server.
[email protected]0f8f1b432010-03-16 19:06:03181 if (!command_line.HasSwitch(switches::kHostResolverRules))
[email protected]c54a8912012-10-22 22:09:43182 return global_host_resolver.PassAs<net::HostResolver>();
[email protected]0ac83682010-01-22 17:46:27183
[email protected]c54a8912012-10-22 22:09:43184 scoped_ptr<net::MappedHostResolver> remapped_resolver(
185 new net::MappedHostResolver(global_host_resolver.Pass()));
[email protected]0f8f1b432010-03-16 19:06:03186 remapped_resolver->SetRulesFromString(
187 command_line.GetSwitchValueASCII(switches::kHostResolverRules));
[email protected]c54a8912012-10-22 22:09:43188 return remapped_resolver.PassAs<net::HostResolver>();
[email protected]0ac83682010-01-22 17:46:27189}
190
[email protected]ef2bf422012-05-11 03:27:09191// TODO(willchan): Remove proxy script fetcher context since it's not necessary
192// now that I got rid of refcounting URLRequestContexts.
[email protected]77feb462011-05-16 23:37:25193// See IOThread::Globals for details.
[email protected]ef2bf422012-05-11 03:27:09194net::URLRequestContext*
[email protected]2fb629202010-12-23 23:52:57195ConstructProxyScriptFetcherContext(IOThread::Globals* globals,
196 net::NetLog* net_log) {
[email protected]ef2bf422012-05-11 03:27:09197 net::URLRequestContext* context = new URLRequestContextWithUserAgent;
[email protected]2fb629202010-12-23 23:52:57198 context->set_net_log(net_log);
199 context->set_host_resolver(globals->host_resolver.get());
200 context->set_cert_verifier(globals->cert_verifier.get());
[email protected]a2a41972011-12-07 17:47:27201 context->set_transport_security_state(
202 globals->transport_security_state.get());
[email protected]2fb629202010-12-23 23:52:57203 context->set_http_auth_handler_factory(
204 globals->http_auth_handler_factory.get());
205 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get());
206 context->set_http_transaction_factory(
[email protected]52617df2010-12-24 07:30:01207 globals->proxy_script_fetcher_http_transaction_factory.get());
[email protected]933bc5c62011-04-12 19:08:02208 context->set_ftp_transaction_factory(
209 globals->proxy_script_fetcher_ftp_transaction_factory.get());
[email protected]273e37d2011-08-11 01:49:12210 context->set_cookie_store(globals->system_cookie_store.get());
[email protected]9c4eff22012-03-20 22:42:29211 context->set_server_bound_cert_service(
212 globals->system_server_bound_cert_service.get());
[email protected]3ce02412011-03-01 12:01:15213 context->set_network_delegate(globals->system_network_delegate.get());
[email protected]db96a882011-10-09 02:01:54214 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
215 // system URLRequestContext too. There's no reason this should be tied to a
216 // profile.
[email protected]2fb629202010-12-23 23:52:57217 return context;
218}
219
[email protected]ef2bf422012-05-11 03:27:09220net::URLRequestContext*
[email protected]db0e86dd2011-03-16 14:47:21221ConstructSystemRequestContext(IOThread::Globals* globals,
222 net::NetLog* net_log) {
[email protected]ef2bf422012-05-11 03:27:09223 net::URLRequestContext* context = new SystemURLRequestContext;
[email protected]db0e86dd2011-03-16 14:47:21224 context->set_net_log(net_log);
225 context->set_host_resolver(globals->host_resolver.get());
226 context->set_cert_verifier(globals->cert_verifier.get());
[email protected]a2a41972011-12-07 17:47:27227 context->set_transport_security_state(
228 globals->transport_security_state.get());
[email protected]db0e86dd2011-03-16 14:47:21229 context->set_http_auth_handler_factory(
230 globals->http_auth_handler_factory.get());
231 context->set_proxy_service(globals->system_proxy_service.get());
232 context->set_http_transaction_factory(
233 globals->system_http_transaction_factory.get());
[email protected]933bc5c62011-04-12 19:08:02234 context->set_ftp_transaction_factory(
235 globals->system_ftp_transaction_factory.get());
[email protected]273e37d2011-08-11 01:49:12236 context->set_cookie_store(globals->system_cookie_store.get());
[email protected]9c4eff22012-03-20 22:42:29237 context->set_server_bound_cert_service(
238 globals->system_server_bound_cert_service.get());
[email protected]a73a2802012-05-02 19:20:15239 context->set_throttler_manager(globals->throttler_manager.get());
[email protected]815c69cf2012-06-30 00:52:08240 context->set_network_delegate(globals->system_network_delegate.get());
[email protected]db0e86dd2011-03-16 14:47:21241 return context;
242}
243
[email protected]0ac83682010-01-22 17:46:27244} // namespace
245
[email protected]e0845d5f2012-05-29 00:11:41246class IOThread::LoggingNetworkChangeObserver
247 : public net::NetworkChangeNotifier::IPAddressObserver {
248 public:
249 // |net_log| must remain valid throughout our lifetime.
250 explicit LoggingNetworkChangeObserver(net::NetLog* net_log)
251 : net_log_(net_log) {
252 net::NetworkChangeNotifier::AddIPAddressObserver(this);
253 }
254
255 ~LoggingNetworkChangeObserver() {
256 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
257 }
258
259 virtual void OnIPAddressChanged() {
260 VLOG(1) << "Observed a change to the network IP addresses";
261
[email protected]2fa08912012-06-14 20:56:26262 net_log_->AddGlobalEntry(net::NetLog::TYPE_NETWORK_IP_ADDRESSES_CHANGED);
[email protected]e0845d5f2012-05-29 00:11:41263 }
264
265 private:
266 net::NetLog* net_log_;
267 DISALLOW_COPY_AND_ASSIGN(LoggingNetworkChangeObserver);
268};
269
[email protected]abe2c032011-03-31 18:49:34270class SystemURLRequestContextGetter : public net::URLRequestContextGetter {
[email protected]db0e86dd2011-03-16 14:47:21271 public:
272 explicit SystemURLRequestContextGetter(IOThread* io_thread);
[email protected]db0e86dd2011-03-16 14:47:21273
[email protected]abe2c032011-03-31 18:49:34274 // Implementation for net::UrlRequestContextGetter.
[email protected]4969b0122012-06-16 01:58:28275 virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
276 virtual scoped_refptr<base::SingleThreadTaskRunner>
277 GetNetworkTaskRunner() const OVERRIDE;
[email protected]db0e86dd2011-03-16 14:47:21278
[email protected]13ed17f82012-04-06 02:27:18279 protected:
280 virtual ~SystemURLRequestContextGetter();
281
[email protected]db0e86dd2011-03-16 14:47:21282 private:
283 IOThread* const io_thread_; // Weak pointer, owned by BrowserProcess.
[email protected]4969b0122012-06-16 01:58:28284 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
[email protected]db0e86dd2011-03-16 14:47:21285
286 base::debug::LeakTracker<SystemURLRequestContextGetter> leak_tracker_;
287};
288
289SystemURLRequestContextGetter::SystemURLRequestContextGetter(
290 IOThread* io_thread)
291 : io_thread_(io_thread),
[email protected]4969b0122012-06-16 01:58:28292 network_task_runner_(
[email protected]2e5b60a22011-11-28 15:56:41293 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)) {
[email protected]db0e86dd2011-03-16 14:47:21294}
295
296SystemURLRequestContextGetter::~SystemURLRequestContextGetter() {}
297
298net::URLRequestContext* SystemURLRequestContextGetter::GetURLRequestContext() {
299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
[email protected]ef2bf422012-05-11 03:27:09300 DCHECK(io_thread_->globals()->system_request_context.get());
[email protected]db0e86dd2011-03-16 14:47:21301
[email protected]ef2bf422012-05-11 03:27:09302 return io_thread_->globals()->system_request_context.get();
[email protected]db0e86dd2011-03-16 14:47:21303}
304
[email protected]4969b0122012-06-16 01:58:28305scoped_refptr<base::SingleThreadTaskRunner>
306SystemURLRequestContextGetter::GetNetworkTaskRunner() const {
307 return network_task_runner_;
[email protected]db0e86dd2011-03-16 14:47:21308}
309
[email protected]c93123fa2012-04-19 02:49:48310IOThread::Globals::
311SystemRequestContextLeakChecker::SystemRequestContextLeakChecker(
312 Globals* globals)
313 : globals_(globals) {
314 DCHECK(globals_);
[email protected]7613faae2012-04-18 01:01:19315}
[email protected]1889dc1b2010-10-14 22:03:13316
[email protected]c93123fa2012-04-19 02:49:48317IOThread::Globals::
318SystemRequestContextLeakChecker::~SystemRequestContextLeakChecker() {
319 if (globals_->system_request_context.get())
320 globals_->system_request_context->AssertNoURLRequests();
321}
322
323IOThread::Globals::Globals()
324 : ALLOW_THIS_IN_INITIALIZER_LIST(
[email protected]c2dad292012-09-07 21:27:35325 system_request_context_leak_checker(this)),
326 ignore_certificate_errors(false),
327 http_pipelining_enabled(false),
328 testing_fixed_http_port(0),
329 testing_fixed_https_port(0) {}
330
[email protected]c93123fa2012-04-19 02:49:48331IOThread::Globals::~Globals() {}
332
[email protected]bcefe0f2010-11-10 16:19:10333// |local_state| is passed in explicitly in order to (1) reduce implicit
334// dependencies and (2) make IOThread more flexible for testing.
[email protected]3ce02412011-03-01 12:01:15335IOThread::IOThread(
336 PrefService* local_state,
337 ChromeNetLog* net_log,
[email protected]5a38dfd2012-07-23 23:22:10338 extensions::EventRouterForwarder* extension_event_router_forwarder)
[email protected]2e5b60a22011-11-28 15:56:41339 : net_log_(net_log),
[email protected]3ce02412011-03-01 12:01:15340 extension_event_router_forwarder_(extension_event_router_forwarder),
[email protected]d13c3272010-02-04 00:24:51341 globals_(NULL),
[email protected]4a109492011-09-24 21:00:12342 sdch_manager_(NULL),
[email protected]21ee224e2011-11-21 02:17:53343 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
[email protected]bcefe0f2010-11-10 16:19:10344 // We call RegisterPrefs() here (instead of inside browser_prefs.cc) to make
345 // sure that everything is initialized in the right order.
346 RegisterPrefs(local_state);
347 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes);
348 negotiate_disable_cname_lookup_ = local_state->GetBoolean(
349 prefs::kDisableAuthNegotiateCnameLookup);
350 negotiate_enable_port_ = local_state->GetBoolean(
351 prefs::kEnableAuthNegotiatePort);
352 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist);
353 auth_delegate_whitelist_ = local_state->GetString(
354 prefs::kAuthNegotiateDelegateWhitelist);
[email protected]ac7f3fdb2010-11-12 12:47:05355 gssapi_library_name_ = local_state->GetString(prefs::kGSSAPILibraryName);
[email protected]6f96cbcb2011-11-04 02:26:07356 pref_proxy_config_tracker_.reset(
357 ProxyServiceFactory::CreatePrefProxyConfigTracker(local_state));
[email protected]9d8cfb682012-09-13 16:48:04358 ChromeNetworkDelegate::InitializePrefsOnUIThread(
359 &system_enable_referrers_,
360 NULL,
361 local_state);
[email protected]4d45a6de2011-05-13 05:20:18362 ssl_config_service_manager_.reset(
[email protected]e6426c1b2012-09-12 21:51:41363 SSLConfigServiceManager::CreateDefaultManager(local_state, NULL));
[email protected]2e5b60a22011-11-28 15:56:41364
365 BrowserThread::SetDelegate(BrowserThread::IO, this);
[email protected]bcefe0f2010-11-10 16:19:10366}
[email protected]0ac83682010-01-22 17:46:27367
368IOThread::~IOThread() {
[email protected]2e5b60a22011-11-28 15:56:41369 // This isn't needed for production code, but in tests, IOThread may
370 // be multiply constructed.
371 BrowserThread::SetDelegate(BrowserThread::IO, NULL);
372
[email protected]6f96cbcb2011-11-04 02:26:07373 if (pref_proxy_config_tracker_.get())
[email protected]db0e86dd2011-03-16 14:47:21374 pref_proxy_config_tracker_->DetachFromPrefService();
[email protected]d13c3272010-02-04 00:24:51375 DCHECK(!globals_);
[email protected]0ac83682010-01-22 17:46:27376}
377
[email protected]d13c3272010-02-04 00:24:51378IOThread::Globals* IOThread::globals() {
[email protected]f8b3ef82010-10-11 02:45:52379 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
[email protected]d13c3272010-02-04 00:24:51380 return globals_;
[email protected]0ac83682010-01-22 17:46:27381}
382
[email protected]b2fcd0e2010-12-01 15:19:40383ChromeNetLog* IOThread::net_log() {
384 return net_log_;
385}
386
[email protected]b09f76d62011-12-07 01:51:06387void IOThread::ChangedToOnTheRecord() {
388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
389 BrowserThread::PostTask(
390 BrowserThread::IO,
391 FROM_HERE,
392 base::Bind(&IOThread::ChangedToOnTheRecordOnIOThread,
393 base::Unretained(this)));
394}
395
[email protected]abe2c032011-03-31 18:49:34396net::URLRequestContextGetter* IOThread::system_url_request_context_getter() {
[email protected]db0e86dd2011-03-16 14:47:21397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
398 if (!system_url_request_context_getter_) {
[email protected]addb3242011-06-13 21:39:16399 InitSystemRequestContext();
[email protected]db0e86dd2011-03-16 14:47:21400 }
401 return system_url_request_context_getter_;
402}
403
[email protected]0ac83682010-01-22 17:46:27404void IOThread::Init() {
[email protected]2e5b60a22011-11-28 15:56:41405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
[email protected]70b92342010-10-12 05:54:06406
407#if defined(USE_NSS)
[email protected]8c434cbc2012-03-14 14:25:09408 net::SetMessageLoopForNSSHttpIO();
[email protected]ecd95ae2010-10-20 23:58:17409#endif // defined(USE_NSS)
[email protected]70b92342010-10-12 05:54:06410
[email protected]c2dad292012-09-07 21:27:35411 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
412
[email protected]d13c3272010-02-04 00:24:51413 DCHECK(!globals_);
414 globals_ = new Globals;
415
[email protected]58bc7042010-07-07 18:04:14416 // Add an observer that will emit network change events to the ChromeNetLog.
417 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be
418 // logging the network change before other IO thread consumers respond to it.
419 network_change_observer_.reset(
[email protected]b2fcd0e2010-12-01 15:19:40420 new LoggingNetworkChangeObserver(net_log_));
[email protected]58bc7042010-07-07 18:04:14421
[email protected]cde8b3c2012-08-13 19:20:52422 // Setup the HistogramWatcher to run on the IO thread.
423 net::NetworkChangeNotifier::InitHistogramWatcher();
424
[email protected]3ce02412011-03-01 12:01:15425 globals_->extension_event_router_forwarder =
426 extension_event_router_forwarder_;
[email protected]a1d4ab072012-06-07 13:21:15427 ChromeNetworkDelegate* network_delegate = new ChromeNetworkDelegate(
[email protected]0a8db0d2011-04-13 15:15:40428 extension_event_router_forwarder_,
[email protected]c357acb42011-06-09 20:52:42429 NULL,
[email protected]673514522011-07-13 18:17:18430 NULL,
[email protected]6a5f77c32011-09-04 19:19:59431 NULL,
[email protected]9c8ae8c2012-03-09 13:13:35432 NULL,
[email protected]e9c41d22012-08-17 00:08:15433 NULL,
[email protected]5a07c192012-07-30 20:18:22434 &system_enable_referrers_,
[email protected]9d8cfb682012-09-13 16:48:04435 NULL,
[email protected]5a07c192012-07-30 20:18:22436 NULL);
[email protected]c2dad292012-09-07 21:27:35437 if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling))
[email protected]a1d4ab072012-06-07 13:21:15438 network_delegate->NeverThrottleRequests();
[email protected]a1d4ab072012-06-07 13:21:15439 globals_->system_network_delegate.reset(network_delegate);
[email protected]c54a8912012-10-22 22:09:43440 globals_->host_resolver = CreateGlobalHostResolver(net_log_);
[email protected]9f59fac2012-03-21 23:18:11441 globals_->cert_verifier.reset(net::CertVerifier::CreateDefault());
[email protected]f43b89f32012-05-01 19:39:48442 globals_->transport_security_state.reset(new net::TransportSecurityState());
[email protected]4d45a6de2011-05-13 05:20:18443 globals_->ssl_config_service = GetSSLConfigService();
[email protected]ec44ee02012-09-28 21:31:51444 if (command_line.HasSwitch(switches::kSpdyProxyOrigin)) {
445 spdyproxy_origin_ =
446 command_line.GetSwitchValueASCII(switches::kSpdyProxyOrigin);
447 }
[email protected]65d34382010-07-01 18:12:26448 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
[email protected]73c45322010-10-01 23:57:54449 globals_->host_resolver.get()));
[email protected]17291a022011-10-10 07:32:53450 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl);
[email protected]2fb629202010-12-23 23:52:57451 // For the ProxyScriptFetcher, we use a direct ProxyService.
[email protected]6104ea5d2011-04-27 21:37:12452 globals_->proxy_script_fetcher_proxy_service.reset(
453 net::ProxyService::CreateDirectWithNetLog(net_log_));
[email protected]273e37d2011-08-11 01:49:12454 // In-memory cookie store.
455 globals_->system_cookie_store = new net::CookieMonster(NULL, NULL);
[email protected]9c4eff22012-03-20 22:42:29456 // In-memory server bound cert store.
457 globals_->system_server_bound_cert_service.reset(
458 new net::ServerBoundCertService(
[email protected]5bab49ec2012-05-04 21:13:19459 new net::DefaultServerBoundCertStore(NULL),
460 base::WorkerPool::GetTaskRunner(true)));
[email protected]a9e0d1412012-08-20 22:13:01461 globals_->load_time_stats.reset(new chrome_browser_net::LoadTimeStats());
[email protected]c2dad292012-09-07 21:27:35462 globals_->host_mapping_rules.reset(new net::HostMappingRules());
463 if (command_line.HasSwitch(switches::kHostRules)) {
464 globals_->host_mapping_rules->SetRulesFromString(
465 command_line.GetSwitchValueASCII(switches::kHostRules));
466 }
467 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
468 globals_->ignore_certificate_errors = true;
469 if (command_line.HasSwitch(switches::kEnableHttpPipelining))
470 globals_->http_pipelining_enabled = true;
471 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
472 int value;
473 base::StringToInt(
474 command_line.GetSwitchValueASCII(
475 switches::kTestingFixedHttpPort),
476 &value);
477 globals_->testing_fixed_http_port = value;
478 }
479 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
480 int value;
481 base::StringToInt(
482 command_line.GetSwitchValueASCII(
483 switches::kTestingFixedHttpsPort),
484 &value);
485 globals_->testing_fixed_https_port = value;
486 }
487
[email protected]9e1bdd32011-02-03 21:48:34488 net::HttpNetworkSession::Params session_params;
489 session_params.host_resolver = globals_->host_resolver.get();
490 session_params.cert_verifier = globals_->cert_verifier.get();
[email protected]9c4eff22012-03-20 22:42:29491 session_params.server_bound_cert_service =
492 globals_->system_server_bound_cert_service.get();
[email protected]a2a41972011-12-07 17:47:27493 session_params.transport_security_state =
494 globals_->transport_security_state.get();
[email protected]9e1bdd32011-02-03 21:48:34495 session_params.proxy_service =
496 globals_->proxy_script_fetcher_proxy_service.get();
[email protected]c2dad292012-09-07 21:27:35497 session_params.ssl_config_service = globals_->ssl_config_service.get();
[email protected]9e1bdd32011-02-03 21:48:34498 session_params.http_auth_handler_factory =
499 globals_->http_auth_handler_factory.get();
[email protected]c2dad292012-09-07 21:27:35500 session_params.http_server_properties =
501 globals_->http_server_properties.get();
[email protected]0651b812011-02-24 00:22:50502 session_params.network_delegate = globals_->system_network_delegate.get();
[email protected]db96a882011-10-09 02:01:54503 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
504 // system URLRequestContext too. There's no reason this should be tied to a
505 // profile.
[email protected]9e1bdd32011-02-03 21:48:34506 session_params.net_log = net_log_;
[email protected]c2dad292012-09-07 21:27:35507 session_params.host_mapping_rules = globals_->host_mapping_rules.get();
508 session_params.ignore_certificate_errors =
509 globals_->ignore_certificate_errors;
510 session_params.http_pipelining_enabled = globals_->http_pipelining_enabled;
511 session_params.testing_fixed_http_port = globals_->testing_fixed_http_port;
[email protected]84ed29762012-09-16 04:00:58512 session_params.testing_fixed_https_port = globals_->testing_fixed_https_port;
[email protected]c2dad292012-09-07 21:27:35513
[email protected]57cb0f72011-01-28 06:33:58514 scoped_refptr<net::HttpNetworkSession> network_session(
[email protected]9e1bdd32011-02-03 21:48:34515 new net::HttpNetworkSession(session_params));
[email protected]57cb0f72011-01-28 06:33:58516 globals_->proxy_script_fetcher_http_transaction_factory.reset(
517 new net::HttpNetworkLayer(network_session));
[email protected]933bc5c62011-04-12 19:08:02518 globals_->proxy_script_fetcher_ftp_transaction_factory.reset(
519 new net::FtpNetworkLayer(globals_->host_resolver.get()));
[email protected]2fb629202010-12-23 23:52:57520
[email protected]a73a2802012-05-02 19:20:15521 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager());
[email protected]a1d4ab072012-06-07 13:21:15522 globals_->throttler_manager->set_net_log(net_log_);
[email protected]a73a2802012-05-02 19:20:15523 // Always done in production, disabled only for unit tests.
524 globals_->throttler_manager->set_enable_thread_checks(true);
[email protected]a73a2802012-05-02 19:20:15525
[email protected]ef2bf422012-05-11 03:27:09526 globals_->proxy_script_fetcher_context.reset(
527 ConstructProxyScriptFetcherContext(globals_, net_log_));
[email protected]4a109492011-09-24 21:00:12528
529 sdch_manager_ = new net::SdchManager();
[email protected]2e5b60a22011-11-28 15:56:41530
[email protected]11f5e3a2012-09-27 00:30:13531#if defined(OS_MACOSX) && !defined(OS_IOS)
532 // Start observing Keychain events. This needs to be done on the UI thread,
533 // as Keychain services requires a CFRunLoop.
534 BrowserThread::PostTask(BrowserThread::UI,
535 FROM_HERE,
536 base::Bind(&ObserveKeychainEvents));
537#endif
538
[email protected]2e5b60a22011-11-28 15:56:41539 // InitSystemRequestContext turns right around and posts a task back
540 // to the IO thread, so we can't let it run until we know the IO
541 // thread has started.
542 //
543 // Note that since we are at BrowserThread::Init time, the UI thread
544 // is blocked waiting for the thread to start. Therefore, posting
545 // this task to the main thread's message loop here is guaranteed to
546 // get it onto the message loop while the IOThread object still
547 // exists. However, the message might not be processed on the UI
548 // thread until after IOThread is gone, so use a weak pointer.
549 BrowserThread::PostTask(BrowserThread::UI,
550 FROM_HERE,
551 base::Bind(&IOThread::InitSystemRequestContext,
552 weak_factory_.GetWeakPtr()));
553
554 // We constructed the weak pointer on the IO thread but it will be
555 // used on the UI thread. Call this to avoid a thread checker
556 // error.
557 weak_factory_.DetachFromThread();
[email protected]0ac83682010-01-22 17:46:27558}
559
[email protected]2a92cd92010-04-27 00:01:41560void IOThread::CleanUp() {
[email protected]075c0322012-02-14 00:56:44561 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks();
562
[email protected]4a109492011-09-24 21:00:12563 delete sdch_manager_;
564 sdch_manager_ = NULL;
565
[email protected]59a3b362010-10-21 21:52:41566#if defined(USE_NSS)
[email protected]8c434cbc2012-03-14 14:25:09567 net::ShutdownNSSHttpIO();
[email protected]59a3b362010-10-21 21:52:41568#endif // defined(USE_NSS)
569
[email protected]db0e86dd2011-03-16 14:47:21570 system_url_request_context_getter_ = NULL;
571
[email protected]af669932012-01-17 19:26:58572 // Release objects that the net::URLRequestContext could have been pointing
573 // to.
[email protected]0ee7a3b2010-11-09 06:13:40574
575 // This must be reset before the ChromeNetLog is destroyed.
576 network_change_observer_.reset();
577
[email protected]db0e86dd2011-03-16 14:47:21578 system_proxy_config_service_.reset();
579
[email protected]d13c3272010-02-04 00:24:51580 delete globals_;
581 globals_ = NULL;
[email protected]0ac83682010-01-22 17:46:27582
[email protected]db0e86dd2011-03-16 14:47:21583 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks();
[email protected]0ac83682010-01-22 17:46:27584}
585
[email protected]bcefe0f2010-11-10 16:19:10586// static
587void IOThread::RegisterPrefs(PrefService* local_state) {
588 local_state->RegisterStringPref(prefs::kAuthSchemes,
[email protected]ec44ee02012-09-28 21:31:51589 "basic,digest,ntlm,negotiate,"
590 "spdyproxy");
[email protected]bcefe0f2010-11-10 16:19:10591 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup,
592 false);
593 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);
594 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, "");
595 local_state->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, "");
[email protected]ac7f3fdb2010-11-12 12:47:05596 local_state->RegisterStringPref(prefs::kGSSAPILibraryName, "");
[email protected]ec44ee02012-09-28 21:31:51597 local_state->RegisterStringPref(prefs::kSpdyProxyOrigin, "");
[email protected]0a8db0d2011-04-13 15:15:40598 local_state->RegisterBooleanPref(prefs::kEnableReferrers, true);
[email protected]7a299a92012-10-24 23:54:50599 local_state->RegisterInt64Pref(prefs::kHttpReceivedContentLength, 0);
600 local_state->RegisterInt64Pref(prefs::kHttpOriginalContentLength, 0);
[email protected]bcefe0f2010-11-10 16:19:10601}
602
[email protected]65d34382010-07-01 18:12:26603net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory(
604 net::HostResolver* resolver) {
[email protected]9030a632010-11-19 20:12:09605 net::HttpAuthFilterWhitelist* auth_filter_default_credentials = NULL;
606 if (!auth_server_whitelist_.empty()) {
607 auth_filter_default_credentials =
608 new net::HttpAuthFilterWhitelist(auth_server_whitelist_);
609 }
610 net::HttpAuthFilterWhitelist* auth_filter_delegate = NULL;
611 if (!auth_delegate_whitelist_.empty()) {
612 auth_filter_delegate =
613 new net::HttpAuthFilterWhitelist(auth_delegate_whitelist_);
614 }
[email protected]b4955e7d2010-04-16 20:22:30615 globals_->url_security_manager.reset(
[email protected]d201b200e2010-08-27 17:35:02616 net::URLSecurityManager::Create(auth_filter_default_credentials,
617 auth_filter_delegate));
[email protected]b7304162010-08-23 17:42:29618 std::vector<std::string> supported_schemes;
[email protected]bcefe0f2010-11-10 16:19:10619 base::SplitString(auth_schemes_, ',', &supported_schemes);
[email protected]b7304162010-08-23 17:42:29620
[email protected]ec44ee02012-09-28 21:31:51621 scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory(
622 net::HttpAuthHandlerRegistryFactory::Create(
623 supported_schemes, globals_->url_security_manager.get(),
624 resolver, gssapi_library_name_, negotiate_disable_cname_lookup_,
625 negotiate_enable_port_));
626
627 if (!spdyproxy_origin_.empty()) {
628 GURL origin_url(spdyproxy_origin_);
629 if (origin_url.is_valid()) {
630 registry_factory->RegisterSchemeFactory(
631 "spdyproxy",
632 new spdyproxy::HttpAuthHandlerSpdyProxy::Factory(origin_url));
633 } else {
634 LOG(WARNING) << "Skipping creation of SpdyProxy auth handler since "
635 << "authorized origin is invalid: "
636 << spdyproxy_origin_;
637 }
638 }
639
640 return registry_factory.release();
[email protected]eb3cac72010-02-26 21:07:45641}
642
[email protected]d6f37fc2011-02-13 23:58:41643void IOThread::ClearHostCache() {
644 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
645
[email protected]489d1a82011-10-12 03:09:11646 net::HostCache* host_cache = globals_->host_resolver->GetHostCache();
647 if (host_cache)
648 host_cache->clear();
[email protected]0ac83682010-01-22 17:46:27649}
[email protected]db0e86dd2011-03-16 14:47:21650
[email protected]4d45a6de2011-05-13 05:20:18651net::SSLConfigService* IOThread::GetSSLConfigService() {
652 return ssl_config_service_manager_->Get();
653}
654
[email protected]b09f76d62011-12-07 01:51:06655void IOThread::ChangedToOnTheRecordOnIOThread() {
656 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
657
658 // Clear the host cache to avoid showing entries from the OTR session
659 // in about:net-internals.
660 ClearHostCache();
[email protected]b09f76d62011-12-07 01:51:06661}
662
[email protected]db0e86dd2011-03-16 14:47:21663void IOThread::InitSystemRequestContext() {
[email protected]addb3242011-06-13 21:39:16664 if (system_url_request_context_getter_)
665 return;
[email protected]63e26822011-07-16 19:07:35666 // If we're in unit_tests, IOThread may not be run.
[email protected]dd483702011-12-02 14:47:42667 if (!BrowserThread::IsMessageLoopValid(BrowserThread::IO))
[email protected]63e26822011-07-16 19:07:35668 return;
[email protected]71fdf772011-12-18 16:28:38669 bool wait_for_first_update = (pref_proxy_config_tracker_.get() != NULL);
[email protected]6f96cbcb2011-11-04 02:26:07670 ChromeProxyConfigService* proxy_config_service =
[email protected]71fdf772011-12-18 16:28:38671 ProxyServiceFactory::CreateProxyConfigService(wait_for_first_update);
[email protected]6f96cbcb2011-11-04 02:26:07672 system_proxy_config_service_.reset(proxy_config_service);
673 if (pref_proxy_config_tracker_.get()) {
674 pref_proxy_config_tracker_->SetChromeProxyConfigService(
675 proxy_config_service);
676 }
[email protected]addb3242011-06-13 21:39:16677 system_url_request_context_getter_ =
678 new SystemURLRequestContextGetter(this);
[email protected]2e5b60a22011-11-28 15:56:41679 // Safe to post an unretained this pointer, since IOThread is
680 // guaranteed to outlive the IO BrowserThread.
[email protected]dd483702011-12-02 14:47:42681 BrowserThread::PostTask(
682 BrowserThread::IO,
683 FROM_HERE,
684 base::Bind(&IOThread::InitSystemRequestContextOnIOThread,
685 base::Unretained(this)));
[email protected]addb3242011-06-13 21:39:16686}
687
688void IOThread::InitSystemRequestContextOnIOThread() {
[email protected]db0e86dd2011-03-16 14:47:21689 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
[email protected]6104ea5d2011-04-27 21:37:12690 DCHECK(!globals_->system_proxy_service.get());
[email protected]db0e86dd2011-03-16 14:47:21691 DCHECK(system_proxy_config_service_.get());
692
693 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
[email protected]6104ea5d2011-04-27 21:37:12694 globals_->system_proxy_service.reset(
[email protected]db0e86dd2011-03-16 14:47:21695 ProxyServiceFactory::CreateProxyService(
696 net_log_,
[email protected]ef2bf422012-05-11 03:27:09697 globals_->proxy_script_fetcher_context.get(),
[email protected]db0e86dd2011-03-16 14:47:21698 system_proxy_config_service_.release(),
[email protected]6104ea5d2011-04-27 21:37:12699 command_line));
[email protected]c2dad292012-09-07 21:27:35700
[email protected]db0e86dd2011-03-16 14:47:21701 net::HttpNetworkSession::Params system_params;
702 system_params.host_resolver = globals_->host_resolver.get();
703 system_params.cert_verifier = globals_->cert_verifier.get();
[email protected]9c4eff22012-03-20 22:42:29704 system_params.server_bound_cert_service =
705 globals_->system_server_bound_cert_service.get();
[email protected]a2a41972011-12-07 17:47:27706 system_params.transport_security_state =
707 globals_->transport_security_state.get();
[email protected]db0e86dd2011-03-16 14:47:21708 system_params.proxy_service = globals_->system_proxy_service.get();
709 system_params.ssl_config_service = globals_->ssl_config_service.get();
710 system_params.http_auth_handler_factory =
711 globals_->http_auth_handler_factory.get();
[email protected]17291a022011-10-10 07:32:53712 system_params.http_server_properties = globals_->http_server_properties.get();
[email protected]db0e86dd2011-03-16 14:47:21713 system_params.network_delegate = globals_->system_network_delegate.get();
714 system_params.net_log = net_log_;
[email protected]c2dad292012-09-07 21:27:35715 system_params.host_mapping_rules = globals_->host_mapping_rules.get();
716 system_params.ignore_certificate_errors = globals_->ignore_certificate_errors;
717 system_params.http_pipelining_enabled = globals_->http_pipelining_enabled;
718 system_params.testing_fixed_http_port = globals_->testing_fixed_http_port;
719 system_params.testing_fixed_https_port = globals_->testing_fixed_https_port;
720
[email protected]db0e86dd2011-03-16 14:47:21721 globals_->system_http_transaction_factory.reset(
722 new net::HttpNetworkLayer(
723 new net::HttpNetworkSession(system_params)));
[email protected]933bc5c62011-04-12 19:08:02724 globals_->system_ftp_transaction_factory.reset(
725 new net::FtpNetworkLayer(globals_->host_resolver.get()));
[email protected]ef2bf422012-05-11 03:27:09726 globals_->system_request_context.reset(
727 ConstructSystemRequestContext(globals_, net_log_));
[email protected]d24fc3a02012-02-11 02:08:34728
729 sdch_manager_->set_sdch_fetcher(
730 new SdchDictionaryFetcher(system_url_request_context_getter_.get()));
[email protected]db0e86dd2011-03-16 14:47:21731}