OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/net/chrome_url_request_context.h" | 28 #include "chrome/browser/net/chrome_url_request_context.h" |
29 #include "chrome/browser/net/connect_interceptor.h" | 29 #include "chrome/browser/net/connect_interceptor.h" |
30 #include "chrome/browser/net/dns_probe_service.h" | 30 #include "chrome/browser/net/dns_probe_service.h" |
31 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 31 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
32 #include "chrome/browser/net/load_time_stats.h" | 32 #include "chrome/browser/net/load_time_stats.h" |
33 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 33 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
34 #include "chrome/browser/net/proxy_service_factory.h" | 34 #include "chrome/browser/net/proxy_service_factory.h" |
35 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 35 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
36 #include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h" | 36 #include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h" |
37 #include "chrome/browser/policy/policy_service.h" | 37 #include "chrome/browser/policy/policy_service.h" |
| 38 #include "chrome/browser/prefs/pref_registrar_simple.h" |
38 #include "chrome/browser/prefs/pref_service.h" | 39 #include "chrome/browser/prefs/pref_service.h" |
39 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
40 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
41 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
42 #include "net/base/cert_verifier.h" | 43 #include "net/base/cert_verifier.h" |
43 #include "net/base/default_server_bound_cert_store.h" | 44 #include "net/base/default_server_bound_cert_store.h" |
44 #include "net/base/host_cache.h" | 45 #include "net/base/host_cache.h" |
45 #include "net/base/host_mapping_rules.h" | 46 #include "net/base/host_mapping_rules.h" |
46 #include "net/base/host_resolver.h" | 47 #include "net/base/host_resolver.h" |
47 #include "net/base/mapped_host_resolver.h" | 48 #include "net/base/mapped_host_resolver.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 ignore_certificate_errors(false), | 351 ignore_certificate_errors(false), |
351 http_pipelining_enabled(false), | 352 http_pipelining_enabled(false), |
352 testing_fixed_http_port(0), | 353 testing_fixed_http_port(0), |
353 testing_fixed_https_port(0) {} | 354 testing_fixed_https_port(0) {} |
354 | 355 |
355 IOThread::Globals::~Globals() {} | 356 IOThread::Globals::~Globals() {} |
356 | 357 |
357 // |local_state| is passed in explicitly in order to (1) reduce implicit | 358 // |local_state| is passed in explicitly in order to (1) reduce implicit |
358 // dependencies and (2) make IOThread more flexible for testing. | 359 // dependencies and (2) make IOThread more flexible for testing. |
359 IOThread::IOThread( | 360 IOThread::IOThread( |
360 PrefServiceSimple* local_state, | 361 PrefService* local_state, |
361 policy::PolicyService* policy_service, | 362 policy::PolicyService* policy_service, |
362 ChromeNetLog* net_log, | 363 ChromeNetLog* net_log, |
363 extensions::EventRouterForwarder* extension_event_router_forwarder) | 364 extensions::EventRouterForwarder* extension_event_router_forwarder) |
364 : net_log_(net_log), | 365 : net_log_(net_log), |
365 extension_event_router_forwarder_(extension_event_router_forwarder), | 366 extension_event_router_forwarder_(extension_event_router_forwarder), |
366 globals_(NULL), | 367 globals_(NULL), |
367 sdch_manager_(NULL), | 368 sdch_manager_(NULL), |
368 is_spdy_disabled_by_policy_(false), | 369 is_spdy_disabled_by_policy_(false), |
369 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 370 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
370 // We call RegisterPrefs() here (instead of inside browser_prefs.cc) to make | 371 // We call RegisterPrefs() here (instead of inside browser_prefs.cc) to make |
371 // sure that everything is initialized in the right order. | 372 // sure that everything is initialized in the right order. |
372 // | 373 // |
373 // TODO(joi): See if we can fix so it does get registered from | 374 // TODO(joi): See if we can fix so it does get registered from |
374 // browser_prefs::RegisterLocalState. | 375 // browser_prefs::RegisterLocalState. |
375 RegisterPrefs(local_state); | 376 PrefRegistrarSimple registrar(local_state); |
| 377 RegisterPrefs(®istrar); |
376 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); | 378 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); |
377 negotiate_disable_cname_lookup_ = local_state->GetBoolean( | 379 negotiate_disable_cname_lookup_ = local_state->GetBoolean( |
378 prefs::kDisableAuthNegotiateCnameLookup); | 380 prefs::kDisableAuthNegotiateCnameLookup); |
379 negotiate_enable_port_ = local_state->GetBoolean( | 381 negotiate_enable_port_ = local_state->GetBoolean( |
380 prefs::kEnableAuthNegotiatePort); | 382 prefs::kEnableAuthNegotiatePort); |
381 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist); | 383 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist); |
382 auth_delegate_whitelist_ = local_state->GetString( | 384 auth_delegate_whitelist_ = local_state->GetString( |
383 prefs::kAuthNegotiateDelegateWhitelist); | 385 prefs::kAuthNegotiateDelegateWhitelist); |
384 gssapi_library_name_ = local_state->GetString(prefs::kGSSAPILibraryName); | 386 gssapi_library_name_ = local_state->GetString(prefs::kGSSAPILibraryName); |
385 pref_proxy_config_tracker_.reset( | 387 pref_proxy_config_tracker_.reset( |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 globals_->initial_max_spdy_concurrent_streams.set(streams); | 716 globals_->initial_max_spdy_concurrent_streams.set(streams); |
715 } else if (option.empty() && it == spdy_options.begin()) { | 717 } else if (option.empty() && it == spdy_options.begin()) { |
716 continue; | 718 continue; |
717 } else { | 719 } else { |
718 LOG(DFATAL) << "Unrecognized spdy option: " << option; | 720 LOG(DFATAL) << "Unrecognized spdy option: " << option; |
719 } | 721 } |
720 } | 722 } |
721 } | 723 } |
722 | 724 |
723 // static | 725 // static |
724 void IOThread::RegisterPrefs(PrefServiceSimple* local_state) { | 726 void IOThread::RegisterPrefs(PrefRegistrarSimple* local_state) { |
725 local_state->RegisterStringPref(prefs::kAuthSchemes, | 727 local_state->RegisterStringPref(prefs::kAuthSchemes, |
726 "basic,digest,ntlm,negotiate," | 728 "basic,digest,ntlm,negotiate," |
727 "spdyproxy"); | 729 "spdyproxy"); |
728 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, | 730 local_state->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, |
729 false); | 731 false); |
730 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); | 732 local_state->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); |
731 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, ""); | 733 local_state->RegisterStringPref(prefs::kAuthServerWhitelist, ""); |
732 local_state->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); | 734 local_state->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); |
733 local_state->RegisterStringPref(prefs::kGSSAPILibraryName, ""); | 735 local_state->RegisterStringPref(prefs::kGSSAPILibraryName, ""); |
734 local_state->RegisterStringPref(prefs::kSpdyProxyOrigin, ""); | 736 local_state->RegisterStringPref(prefs::kSpdyProxyOrigin, ""); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 globals_->system_request_context.reset( | 892 globals_->system_request_context.reset( |
891 ConstructSystemRequestContext(globals_, net_log_)); | 893 ConstructSystemRequestContext(globals_, net_log_)); |
892 | 894 |
893 sdch_manager_->set_sdch_fetcher( | 895 sdch_manager_->set_sdch_fetcher( |
894 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 896 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
895 } | 897 } |
896 | 898 |
897 void IOThread::UpdateDnsClientEnabled() { | 899 void IOThread::UpdateDnsClientEnabled() { |
898 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 900 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
899 } | 901 } |
OLD | NEW |