| 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/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/net/chrome_net_log.h" | 33 #include "chrome/browser/net/chrome_net_log.h" |
| 34 #include "chrome/browser/net/chrome_network_delegate.h" | 34 #include "chrome/browser/net/chrome_network_delegate.h" |
| 35 #include "chrome/browser/net/connect_interceptor.h" | 35 #include "chrome/browser/net/connect_interceptor.h" |
| 36 #include "chrome/browser/net/dns_probe_service.h" | 36 #include "chrome/browser/net/dns_probe_service.h" |
| 37 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 37 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 38 #include "chrome/browser/net/proxy_service_factory.h" | 38 #include "chrome/browser/net/proxy_service_factory.h" |
| 39 #include "chrome/common/channel_info.h" | 39 #include "chrome/common/channel_info.h" |
| 40 #include "chrome/common/chrome_content_client.h" | 40 #include "chrome/common/chrome_content_client.h" |
| 41 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
| 42 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 43 #include "components/certificate_transparency/log_proof_fetcher.h" |
| 44 #include "components/certificate_transparency/tree_state_tracker.h" |
| 43 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
| 44 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 46 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 45 #include "components/policy/core/common/policy_service.h" | 47 #include "components/policy/core/common/policy_service.h" |
| 46 #include "components/variations/variations_associated_data.h" | 48 #include "components/variations/variations_associated_data.h" |
| 47 #include "components/version_info/version_info.h" | 49 #include "components/version_info/version_info.h" |
| 48 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
| 49 #include "content/public/browser/cookie_store_factory.h" | 51 #include "content/public/browser/cookie_store_factory.h" |
| 50 #include "content/public/common/user_agent.h" | 52 #include "content/public/common/user_agent.h" |
| 51 #include "net/base/host_mapping_rules.h" | 53 #include "net/base/host_mapping_rules.h" |
| 52 #include "net/base/net_util.h" | 54 #include "net/base/net_util.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 << "Unable to decode CT public key."; | 705 << "Unable to decode CT public key."; |
| 704 scoped_refptr<net::CTLogVerifier> external_log_verifier( | 706 scoped_refptr<net::CTLogVerifier> external_log_verifier( |
| 705 net::CTLogVerifier::Create(ct_public_key_data, log_description, | 707 net::CTLogVerifier::Create(ct_public_key_data, log_description, |
| 706 log_url)); | 708 log_url)); |
| 707 CHECK(external_log_verifier) << "Unable to parse CT public key."; | 709 CHECK(external_log_verifier) << "Unable to parse CT public key."; |
| 708 VLOG(1) << "Adding log with description " << log_description; | 710 VLOG(1) << "Adding log with description " << log_description; |
| 709 ct_logs.push_back(external_log_verifier); | 711 ct_logs.push_back(external_log_verifier); |
| 710 } | 712 } |
| 711 } | 713 } |
| 712 | 714 |
| 715 globals_->ct_logs.assign(ct_logs.begin(), ct_logs.end()); |
| 716 |
| 713 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 717 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 714 // is fixed. | 718 // is fixed. |
| 715 tracked_objects::ScopedTracker tracking_profile9( | 719 tracked_objects::ScopedTracker tracking_profile9( |
| 716 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 720 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 717 "466432 IOThread::InitAsync::CreateLogVerifiers::End")); | 721 "466432 IOThread::InitAsync::CreateLogVerifiers::End")); |
| 718 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 722 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 719 // is fixed. | 723 // is fixed. |
| 720 tracked_objects::ScopedTracker tracking_profile7( | 724 tracked_objects::ScopedTracker tracking_profile7( |
| 721 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 725 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 722 "466432 IOThread::InitAsync::CreateMultiLogVerifier")); | 726 "466432 IOThread::InitAsync::CreateMultiLogVerifier")); |
| 723 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier(); | 727 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier(); |
| 724 globals_->cert_transparency_verifier.reset(ct_verifier); | 728 globals_->cert_transparency_verifier.reset(ct_verifier); |
| 725 // Add built-in logs | 729 // Add built-in logs |
| 726 ct_verifier->AddLogs(ct_logs); | 730 ct_verifier->AddLogs(globals_->ct_logs); |
| 727 | 731 |
| 728 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 732 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 729 // is fixed. | 733 // is fixed. |
| 730 tracked_objects::ScopedTracker tracking_profile10( | 734 tracked_objects::ScopedTracker tracking_profile10( |
| 731 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 735 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 732 "466432 IOThread::InitAsync::CertPolicyEnforcer")); | 736 "466432 IOThread::InitAsync::CertPolicyEnforcer")); |
| 733 net::CertPolicyEnforcer* policy_enforcer = new net::CertPolicyEnforcer; | 737 net::CertPolicyEnforcer* policy_enforcer = new net::CertPolicyEnforcer; |
| 734 globals_->cert_policy_enforcer.reset(policy_enforcer); | 738 globals_->cert_policy_enforcer.reset(policy_enforcer); |
| 735 | 739 |
| 736 globals_->ssl_config_service = GetSSLConfigService(); | 740 globals_->ssl_config_service = GetSSLConfigService(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); | 907 base::debug::LeakTracker<SafeBrowsingURLRequestContext>::CheckForLeaks(); |
| 904 | 908 |
| 905 #if defined(USE_NSS_CERTS) || defined(OS_IOS) | 909 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
| 906 net::ShutdownNSSHttpIO(); | 910 net::ShutdownNSSHttpIO(); |
| 907 #endif | 911 #endif |
| 908 | 912 |
| 909 system_url_request_context_getter_ = NULL; | 913 system_url_request_context_getter_ = NULL; |
| 910 | 914 |
| 911 // Release objects that the net::URLRequestContext could have been pointing | 915 // Release objects that the net::URLRequestContext could have been pointing |
| 912 // to. | 916 // to. |
| 917 globals()->cert_transparency_verifier->SetObserver(nullptr); |
| 913 | 918 |
| 914 // Shutdown the HistogramWatcher on the IO thread. | 919 // Shutdown the HistogramWatcher on the IO thread. |
| 915 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); | 920 net::NetworkChangeNotifier::ShutdownHistogramWatcher(); |
| 916 | 921 |
| 917 // This must be reset before the ChromeNetLog is destroyed. | 922 // This must be reset before the ChromeNetLog is destroyed. |
| 918 network_change_observer_.reset(); | 923 network_change_observer_.reset(); |
| 919 | 924 |
| 920 system_proxy_config_service_.reset(); | 925 system_proxy_config_service_.reset(); |
| 921 | 926 |
| 922 delete globals_; | 927 delete globals_; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 new net::HttpNetworkLayer( | 1235 new net::HttpNetworkLayer( |
| 1231 new net::HttpNetworkSession(system_params))); | 1236 new net::HttpNetworkSession(system_params))); |
| 1232 globals_->system_url_request_job_factory.reset( | 1237 globals_->system_url_request_job_factory.reset( |
| 1233 new net::URLRequestJobFactoryImpl()); | 1238 new net::URLRequestJobFactoryImpl()); |
| 1234 globals_->system_request_context.reset( | 1239 globals_->system_request_context.reset( |
| 1235 ConstructSystemRequestContext(globals_, net_log_)); | 1240 ConstructSystemRequestContext(globals_, net_log_)); |
| 1236 globals_->system_request_context->set_ssl_config_service( | 1241 globals_->system_request_context->set_ssl_config_service( |
| 1237 globals_->ssl_config_service.get()); | 1242 globals_->ssl_config_service.get()); |
| 1238 globals_->system_request_context->set_http_server_properties( | 1243 globals_->system_request_context->set_http_server_properties( |
| 1239 globals_->http_server_properties->GetWeakPtr()); | 1244 globals_->http_server_properties->GetWeakPtr()); |
| 1245 |
| 1246 VLOG(1) << "Creating TreeStateTracker observer on IOThread."; |
| 1247 scoped_ptr<certificate_transparency::LogProofFetcher> proof_fetcher( |
| 1248 new certificate_transparency::LogProofFetcher( |
| 1249 globals_->system_request_context.get())); |
| 1250 |
| 1251 certificate_transparency::TreeStateTracker* scts_observer( |
| 1252 new certificate_transparency::TreeStateTracker(proof_fetcher.Pass(), |
| 1253 globals_->ct_logs)); |
| 1254 globals_->cert_transparency_observer.reset(scts_observer); |
| 1255 // The |cert_transparency_verifier| is the same one held by |
| 1256 // the |proxy_script_fetcher_context| and |system_request_context|, |
| 1257 // so no need to set the observer in their cert_transparency_verifiers. |
| 1258 globals_->cert_transparency_verifier->SetObserver(scts_observer); |
| 1259 VLOG(1) << "TreeStateTracker observer on IOThread created."; |
| 1240 } | 1260 } |
| 1241 | 1261 |
| 1242 void IOThread::UpdateDnsClientEnabled() { | 1262 void IOThread::UpdateDnsClientEnabled() { |
| 1243 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 1263 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
| 1244 } | 1264 } |
| 1245 | 1265 |
| 1246 void IOThread::ConfigureQuic(const base::CommandLine& command_line) { | 1266 void IOThread::ConfigureQuic(const base::CommandLine& command_line) { |
| 1247 // Always fetch the field trial group to ensure it is reported correctly. | 1267 // Always fetch the field trial group to ensure it is reported correctly. |
| 1248 // The command line flags will be associated with a group that is reported | 1268 // The command line flags will be associated with a group that is reported |
| 1249 // so long as trial is actually queried. | 1269 // so long as trial is actually queried. |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1613 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1594 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1614 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1595 net::QuicVersion version = supported_versions[i]; | 1615 net::QuicVersion version = supported_versions[i]; |
| 1596 if (net::QuicVersionToString(version) == quic_version) { | 1616 if (net::QuicVersionToString(version) == quic_version) { |
| 1597 return version; | 1617 return version; |
| 1598 } | 1618 } |
| 1599 } | 1619 } |
| 1600 | 1620 |
| 1601 return net::QUIC_VERSION_UNSUPPORTED; | 1621 return net::QUIC_VERSION_UNSUPPORTED; |
| 1602 } | 1622 } |
| OLD | NEW |