Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 #include "base/strings/utf_string_conversions.h" | 29 #include "base/strings/utf_string_conversions.h" |
| 30 #include "base/task_scheduler/post_task.h" | 30 #include "base/task_scheduler/post_task.h" |
| 31 #include "base/threading/thread.h" | 31 #include "base/threading/thread.h" |
| 32 #include "base/time/time.h" | 32 #include "base/time/time.h" |
| 33 #include "base/trace_event/trace_event.h" | 33 #include "base/trace_event/trace_event.h" |
| 34 #include "build/build_config.h" | 34 #include "build/build_config.h" |
| 35 #include "chrome/browser/browser_process.h" | 35 #include "chrome/browser/browser_process.h" |
| 36 #include "chrome/browser/data_usage/tab_id_annotator.h" | 36 #include "chrome/browser/data_usage/tab_id_annotator.h" |
| 37 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" | 37 #include "chrome/browser/data_use_measurement/chrome_data_use_ascriber.h" |
| 38 #include "chrome/browser/net/async_dns_field_trial.h" | 38 #include "chrome/browser/net/async_dns_field_trial.h" |
| 39 #include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h" | |
| 39 #include "chrome/browser/net/chrome_network_delegate.h" | 40 #include "chrome/browser/net/chrome_network_delegate.h" |
| 40 #include "chrome/browser/net/dns_probe_service.h" | 41 #include "chrome/browser/net/dns_probe_service.h" |
| 41 #include "chrome/browser/net/proxy_service_factory.h" | 42 #include "chrome/browser/net/proxy_service_factory.h" |
| 42 #include "chrome/browser/net/sth_distributor_provider.h" | 43 #include "chrome/browser/net/sth_distributor_provider.h" |
| 43 #include "chrome/browser/ssl/ignore_errors_cert_verifier.h" | 44 #include "chrome/browser/ssl/ignore_errors_cert_verifier.h" |
| 44 #include "chrome/common/channel_info.h" | 45 #include "chrome/common/channel_info.h" |
| 45 #include "chrome/common/chrome_content_client.h" | 46 #include "chrome/common/chrome_content_client.h" |
| 46 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
| 47 #include "chrome/common/pref_names.h" | 48 #include "chrome/common/pref_names.h" |
| 48 #include "components/certificate_transparency/tree_state_tracker.h" | 49 #include "components/certificate_transparency/tree_state_tracker.h" |
| 49 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" | 50 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref s.h" |
| 50 #include "components/data_usage/core/data_use_aggregator.h" | 51 #include "components/data_usage/core/data_use_aggregator.h" |
| 51 #include "components/data_usage/core/data_use_amortizer.h" | 52 #include "components/data_usage/core/data_use_amortizer.h" |
| 52 #include "components/data_usage/core/data_use_annotator.h" | 53 #include "components/data_usage/core/data_use_annotator.h" |
| 53 #include "components/data_use_measurement/core/data_use_ascriber.h" | 54 #include "components/data_use_measurement/core/data_use_ascriber.h" |
| 54 #include "components/metrics/metrics_service.h" | 55 #include "components/metrics/metrics_service.h" |
| 55 #include "components/net_log/chrome_net_log.h" | 56 #include "components/net_log/chrome_net_log.h" |
| 56 #include "components/network_session_configurator/network_session_configurator.h " | 57 #include "components/network_session_configurator/network_session_configurator.h " |
| 57 #include "components/policy/core/common/policy_service.h" | 58 #include "components/policy/core/common/policy_service.h" |
| 58 #include "components/policy/policy_constants.h" | 59 #include "components/policy/policy_constants.h" |
| 59 #include "components/prefs/pref_registry_simple.h" | 60 #include "components/prefs/pref_registry_simple.h" |
| 60 #include "components/prefs/pref_service.h" | 61 #include "components/prefs/pref_service.h" |
| 61 #include "components/proxy_config/pref_proxy_config_tracker.h" | 62 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 62 #include "components/variations/variations_associated_data.h" | 63 #include "components/variations/variations_associated_data.h" |
| 63 #include "components/version_info/version_info.h" | 64 #include "components/version_info/version_info.h" |
| 64 #include "content/public/browser/browser_thread.h" | 65 #include "content/public/browser/browser_thread.h" |
| 65 #include "content/public/browser/cookie_store_factory.h" | |
| 66 #include "content/public/browser/network_quality_observer_factory.h" | 66 #include "content/public/browser/network_quality_observer_factory.h" |
| 67 #include "content/public/common/content_features.h" | 67 #include "content/public/common/content_features.h" |
| 68 #include "content/public/common/content_switches.h" | 68 #include "content/public/common/content_switches.h" |
| 69 #include "content/public/common/user_agent.h" | 69 #include "content/public/common/user_agent.h" |
| 70 #include "extensions/features/features.h" | 70 #include "extensions/features/features.h" |
| 71 #include "net/base/host_mapping_rules.h" | 71 #include "net/base/host_mapping_rules.h" |
| 72 #include "net/base/logging_network_change_observer.h" | 72 #include "net/base/logging_network_change_observer.h" |
| 73 #include "net/base/sdch_manager.h" | 73 #include "net/base/sdch_manager.h" |
| 74 #include "net/cert/caching_cert_verifier.h" | 74 #include "net/cert/caching_cert_verifier.h" |
| 75 #include "net/cert/cert_verifier.h" | 75 #include "net/cert/cert_verifier.h" |
| 76 #include "net/cert/cert_verify_proc.h" | 76 #include "net/cert/cert_verify_proc.h" |
| 77 #include "net/cert/ct_known_logs.h" | 77 #include "net/cert/ct_known_logs.h" |
| 78 #include "net/cert/ct_log_verifier.h" | 78 #include "net/cert/ct_log_verifier.h" |
| 79 #include "net/cert/ct_policy_enforcer.h" | 79 #include "net/cert/ct_policy_enforcer.h" |
| 80 #include "net/cert/ct_verifier.h" | 80 #include "net/cert/ct_verifier.h" |
| 81 #include "net/cert/multi_log_ct_verifier.h" | 81 #include "net/cert/multi_log_ct_verifier.h" |
| 82 #include "net/cert/multi_threaded_cert_verifier.h" | 82 #include "net/cert/multi_threaded_cert_verifier.h" |
| 83 #include "net/cert/sth_distributor.h" | 83 #include "net/cert/sth_distributor.h" |
| 84 #include "net/cert/sth_observer.h" | 84 #include "net/cert/sth_observer.h" |
| 85 #include "net/cookies/cookie_store.h" | |
| 86 #include "net/dns/host_cache.h" | 85 #include "net/dns/host_cache.h" |
| 87 #include "net/dns/host_resolver.h" | 86 #include "net/dns/host_resolver.h" |
| 88 #include "net/dns/mapped_host_resolver.h" | 87 #include "net/dns/mapped_host_resolver.h" |
| 89 #include "net/http/http_auth_filter.h" | 88 #include "net/http/http_auth_filter.h" |
| 90 #include "net/http/http_auth_handler_factory.h" | 89 #include "net/http/http_auth_handler_factory.h" |
| 91 #include "net/http/http_auth_preferences.h" | 90 #include "net/http/http_auth_preferences.h" |
| 92 #include "net/http/http_network_layer.h" | 91 #include "net/http/http_network_session.h" |
| 93 #include "net/http/http_server_properties_impl.h" | 92 #include "net/http/http_server_properties_impl.h" |
| 93 #include "net/http/http_transaction_factory.h" | |
| 94 #include "net/net_features.h" | 94 #include "net/net_features.h" |
| 95 #include "net/nqe/external_estimate_provider.h" | 95 #include "net/nqe/external_estimate_provider.h" |
| 96 #include "net/nqe/network_quality_estimator_params.h" | 96 #include "net/nqe/network_quality_estimator_params.h" |
| 97 #include "net/proxy/proxy_config_service.h" | 97 #include "net/proxy/proxy_config_service.h" |
| 98 #include "net/proxy/proxy_script_fetcher_impl.h" | 98 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 99 #include "net/proxy/proxy_service.h" | 99 #include "net/proxy/proxy_service.h" |
| 100 #include "net/quic/chromium/quic_utils_chromium.h" | 100 #include "net/quic/chromium/quic_utils_chromium.h" |
| 101 #include "net/socket/ssl_client_socket.h" | 101 #include "net/socket/ssl_client_socket.h" |
| 102 #include "net/socket/tcp_client_socket.h" | 102 #include "net/socket/tcp_client_socket.h" |
| 103 #include "net/ssl/channel_id_service.h" | |
| 104 #include "net/ssl/default_channel_id_store.h" | |
| 105 #include "net/url_request/data_protocol_handler.h" | |
| 106 #include "net/url_request/file_protocol_handler.h" | |
| 107 #include "net/url_request/ftp_protocol_handler.h" | |
| 108 #include "net/url_request/static_http_user_agent_settings.h" | |
| 109 #include "net/url_request/url_fetcher.h" | 103 #include "net/url_request/url_fetcher.h" |
| 110 #include "net/url_request/url_request_context.h" | 104 #include "net/url_request/url_request_context.h" |
| 111 #include "net/url_request/url_request_context_builder.h" | 105 #include "net/url_request/url_request_context_builder.h" |
| 106 #include "net/url_request/url_request_context_builder_mojo.h" | |
| 112 #include "net/url_request/url_request_context_getter.h" | 107 #include "net/url_request/url_request_context_getter.h" |
| 113 #include "net/url_request/url_request_context_storage.h" | |
| 114 #include "net/url_request/url_request_job_factory_impl.h" | |
| 115 #include "url/url_constants.h" | 108 #include "url/url_constants.h" |
| 116 | 109 |
| 117 #if BUILDFLAG(ENABLE_EXTENSIONS) | 110 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 118 #include "chrome/browser/extensions/event_router_forwarder.h" | 111 #include "chrome/browser/extensions/event_router_forwarder.h" |
| 119 #endif | 112 #endif |
| 120 | 113 |
| 121 #if defined(USE_NSS_CERTS) | 114 #if defined(USE_NSS_CERTS) |
| 122 #include "net/cert_net/nss_ocsp.h" | 115 #include "net/cert_net/nss_ocsp.h" |
| 123 #endif | 116 #endif |
| 124 | 117 |
| 125 #if defined(OS_ANDROID) | 118 #if defined(OS_ANDROID) |
| 126 #include "base/android/build_info.h" | 119 #include "base/android/build_info.h" |
| 127 #include "chrome/browser/android/data_usage/external_data_use_observer.h" | 120 #include "chrome/browser/android/data_usage/external_data_use_observer.h" |
| 128 #include "chrome/browser/android/net/external_estimate_provider_android.h" | 121 #include "chrome/browser/android/net/external_estimate_provider_android.h" |
| 129 #include "components/data_usage/android/traffic_stats_amortizer.h" | 122 #include "components/data_usage/android/traffic_stats_amortizer.h" |
| 130 #include "net/cert/cert_net_fetcher.h" | 123 #include "net/cert/cert_net_fetcher.h" |
| 131 #include "net/cert/cert_verify_proc_android.h" | 124 #include "net/cert/cert_verify_proc_android.h" |
| 132 #include "net/cert_net/cert_net_fetcher_impl.h" | 125 #include "net/cert_net/cert_net_fetcher_impl.h" |
| 133 #endif // defined(OS_ANDROID) | 126 #endif // defined(OS_ANDROID) |
| 134 | 127 |
| 135 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
| 136 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" | 129 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
| 137 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 130 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 131 #include "chromeos/network/dhcp_proxy_script_fetcher_factory_chromeos.h" | |
| 138 #include "chromeos/network/host_resolver_impl_chromeos.h" | 132 #include "chromeos/network/host_resolver_impl_chromeos.h" |
| 139 #endif | 133 #endif |
| 140 | 134 |
| 141 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 135 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 142 #include "crypto/openssl_util.h" | 136 #include "crypto/openssl_util.h" |
| 143 #include "third_party/boringssl/src/include/openssl/cpu.h" | 137 #include "third_party/boringssl/src/include/openssl/cpu.h" |
| 144 #endif | 138 #endif |
| 145 | 139 |
| 146 using content::BrowserThread; | 140 using content::BrowserThread; |
| 147 | 141 |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 765 host_cache->ClearForHosts(host_filter); | 759 host_cache->ClearForHosts(host_filter); |
| 766 } | 760 } |
| 767 | 761 |
| 768 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { | 762 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { |
| 769 return session_params_; | 763 return session_params_; |
| 770 } | 764 } |
| 771 | 765 |
| 772 void IOThread::DisableQuic() { | 766 void IOThread::DisableQuic() { |
| 773 session_params_.enable_quic = false; | 767 session_params_.enable_quic = false; |
| 774 | 768 |
| 775 if (globals_->system_request_context_storage) | 769 if (globals_->system_request_context) |
| 776 globals_->system_request_context_storage->http_network_session() | 770 globals_->system_request_context->http_transaction_factory() |
| 771 ->GetSession() | |
| 777 ->DisableQuic(); | 772 ->DisableQuic(); |
| 778 } | 773 } |
| 779 | 774 |
| 780 base::TimeTicks IOThread::creation_time() const { | 775 base::TimeTicks IOThread::creation_time() const { |
| 781 return creation_time_; | 776 return creation_time_; |
| 782 } | 777 } |
| 783 | 778 |
| 784 net::SSLConfigService* IOThread::GetSSLConfigService() { | 779 net::SSLConfigService* IOThread::GetSSLConfigService() { |
| 785 return ssl_config_service_manager_->Get(); | 780 return ssl_config_service_manager_->Get(); |
| 786 } | 781 } |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 810 return quick_check_enabled_.GetValue(); | 805 return quick_check_enabled_.GetValue(); |
| 811 } | 806 } |
| 812 | 807 |
| 813 bool IOThread::PacHttpsUrlStrippingEnabled() const { | 808 bool IOThread::PacHttpsUrlStrippingEnabled() const { |
| 814 return pac_https_url_stripping_enabled_.GetValue(); | 809 return pac_https_url_stripping_enabled_.GetValue(); |
| 815 } | 810 } |
| 816 | 811 |
| 817 void IOThread::ConstructSystemRequestContext() { | 812 void IOThread::ConstructSystemRequestContext() { |
| 818 const base::CommandLine& command_line = | 813 const base::CommandLine& command_line = |
| 819 *base::CommandLine::ForCurrentProcess(); | 814 *base::CommandLine::ForCurrentProcess(); |
| 815 net::URLRequestContextBuilderMojo builder; | |
| 820 | 816 |
| 821 globals_->system_request_context = | 817 builder.set_network_quality_estimator( |
| 822 base::MakeUnique<SystemURLRequestContext>(); | 818 globals_->network_quality_estimator.get()); |
| 823 net::URLRequestContext* context = globals_->system_request_context.get(); | 819 builder.set_enable_brotli(globals_->enable_brotli); |
| 824 globals_->system_request_context_storage = | 820 builder.set_name("system"); |
| 825 base::MakeUnique<net::URLRequestContextStorage>(context); | |
| 826 net::URLRequestContextStorage* context_storage = | |
| 827 globals_->system_request_context_storage.get(); | |
| 828 | 821 |
| 829 context->set_network_quality_estimator( | 822 builder.set_user_agent(GetUserAgent()); |
| 830 globals_->network_quality_estimator.get()); | |
| 831 context->set_enable_brotli(globals_->enable_brotli); | |
| 832 context->set_name("system"); | |
| 833 | |
| 834 context_storage->set_http_user_agent_settings( | |
| 835 base::MakeUnique<net::StaticHttpUserAgentSettings>(std::string(), | |
| 836 GetUserAgent())); | |
| 837 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate( | 823 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate( |
| 838 new ChromeNetworkDelegate(extension_event_router_forwarder(), | 824 new ChromeNetworkDelegate(extension_event_router_forwarder(), |
| 839 &system_enable_referrers_)); | 825 &system_enable_referrers_)); |
| 840 // By default, data usage is considered off the record. | 826 // By default, data usage is considered off the record. |
| 841 chrome_network_delegate->set_data_use_aggregator( | 827 chrome_network_delegate->set_data_use_aggregator( |
| 842 globals_->data_use_aggregator.get(), | 828 globals_->data_use_aggregator.get(), |
| 843 true /* is_data_usage_off_the_record */); | 829 true /* is_data_usage_off_the_record */); |
| 844 context_storage->set_network_delegate( | 830 builder.set_network_delegate( |
| 845 globals_->data_use_ascriber->CreateNetworkDelegate( | 831 globals_->data_use_ascriber->CreateNetworkDelegate( |
| 846 std::move(chrome_network_delegate), GetMetricsDataUseForwarder())); | 832 std::move(chrome_network_delegate), GetMetricsDataUseForwarder())); |
| 847 context->set_net_log(net_log_); | 833 builder.set_net_log(net_log_); |
| 848 context_storage->set_host_resolver(CreateGlobalHostResolver(net_log_)); | 834 std::unique_ptr<net::HostResolver> host_resolver( |
| 835 CreateGlobalHostResolver(net_log_)); | |
| 849 | 836 |
| 850 context_storage->set_ssl_config_service(GetSSLConfigService()); | 837 builder.set_ssl_config_service(GetSSLConfigService()); |
| 851 context_storage->set_http_auth_handler_factory( | 838 builder.SetHttpAuthHandlerFactory( |
| 852 CreateDefaultAuthHandlerFactory(context->host_resolver())); | 839 CreateDefaultAuthHandlerFactory(host_resolver.get())); |
| 853 | 840 |
| 854 // In-memory cookie store. | 841 builder.set_host_resolver(std::move(host_resolver)); |
| 855 context_storage->set_cookie_store( | |
| 856 content::CreateCookieStore(content::CookieStoreConfig())); | |
| 857 // In-memory channel ID store. | |
| 858 context_storage->set_channel_id_service( | |
| 859 base::MakeUnique<net::ChannelIDService>( | |
| 860 new net::DefaultChannelIDStore(nullptr))); | |
| 861 context->cookie_store()->SetChannelIDServiceID( | |
| 862 context->channel_id_service()->GetUniqueID()); | |
| 863 | |
| 864 context_storage->set_transport_security_state( | |
| 865 base::MakeUnique<net::TransportSecurityState>()); | |
| 866 | |
| 867 context_storage->set_http_server_properties( | |
| 868 base::MakeUnique<net::HttpServerPropertiesImpl>()); | |
| 869 | 842 |
| 870 #if defined(OS_CHROMEOS) | 843 #if defined(OS_CHROMEOS) |
| 871 // Creates a CertVerifyProc that doesn't allow any profile-provided certs. | 844 // Creates a CertVerifyProc that doesn't allow any profile-provided certs. |
| 872 context_storage->set_cert_verifier(base::MakeUnique<net::CachingCertVerifier>( | 845 builder.SetCertVerifier(base::MakeUnique<net::CachingCertVerifier>( |
| 873 base::MakeUnique<net::MultiThreadedCertVerifier>( | 846 base::MakeUnique<net::MultiThreadedCertVerifier>( |
| 874 new chromeos::CertVerifyProcChromeOS()))); | 847 new chromeos::CertVerifyProcChromeOS()))); |
| 875 #else | 848 #else |
| 876 context_storage->set_cert_verifier( | 849 builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( |
| 877 IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( | 850 command_line, net::CertVerifier::CreateDefault())); |
| 878 command_line, net::CertVerifier::CreateDefault())); | |
| 879 UMA_HISTOGRAM_BOOLEAN( | 851 UMA_HISTOGRAM_BOOLEAN( |
| 880 "Net.Certificate.IgnoreCertificateErrorsSPKIListPresent", | 852 "Net.Certificate.IgnoreCertificateErrorsSPKIListPresent", |
| 881 command_line.HasSwitch(switches::kIgnoreCertificateErrorsSPKIList)); | 853 command_line.HasSwitch(switches::kIgnoreCertificateErrorsSPKIList)); |
| 882 #endif | 854 #endif |
| 883 | 855 |
| 884 std::unique_ptr<net::MultiLogCTVerifier> ct_verifier = | 856 std::unique_ptr<net::MultiLogCTVerifier> ct_verifier = |
| 885 base::MakeUnique<net::MultiLogCTVerifier>(); | 857 base::MakeUnique<net::MultiLogCTVerifier>(); |
| 886 // Add built-in logs | 858 // Add built-in logs |
| 887 ct_verifier->AddLogs(globals_->ct_logs); | 859 ct_verifier->AddLogs(globals_->ct_logs); |
| 888 | 860 |
| 889 // Register the ct_tree_tracker_ as observer for verified SCTs. | 861 // Register the ct_tree_tracker_ as observer for verified SCTs. |
| 890 ct_verifier->SetObserver(ct_tree_tracker_.get()); | 862 ct_verifier->SetObserver(ct_tree_tracker_.get()); |
| 891 | 863 |
| 892 context_storage->set_cert_transparency_verifier(std::move(ct_verifier)); | 864 builder.set_ct_verifier(std::move(ct_verifier)); |
| 893 | 865 |
| 894 context_storage->set_ct_policy_enforcer( | 866 // TODO(eroman): Figure out why this doesn't work in single-process mode. |
| 895 base::MakeUnique<net::CTPolicyEnforcer>()); | 867 // Should be possible now that a private isolate is used. |
| 868 // http://crbug.com/474654 | |
| 869 if (!command_line.HasSwitch(switches::kWinHttpProxyResolver)) { | |
| 870 if (command_line.HasSwitch(switches::kSingleProcess)) { | |
| 871 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; | |
| 872 } else { | |
| 873 builder.set_mojo_proxy_resolver_factory( | |
| 874 ChromeMojoProxyResolverFactory::GetInstance()); | |
| 875 } | |
| 876 } | |
| 896 | 877 |
| 897 context_storage->set_proxy_service(ProxyServiceFactory::CreateProxyService( | 878 builder.set_pac_quick_check_enabled(WpadQuickCheckEnabled()); |
| 898 net_log_, context, context->network_delegate(), | 879 builder.set_pac_sanitize_url_policy( |
| 899 std::move(system_proxy_config_service_), command_line, | 880 PacHttpsUrlStrippingEnabled() |
| 900 WpadQuickCheckEnabled(), PacHttpsUrlStrippingEnabled())); | 881 ? net::ProxyService::SanitizeUrlPolicy::SAFE |
| 882 : net::ProxyService::SanitizeUrlPolicy::UNSAFE); | |
| 883 #if defined(OS_CHROMEOS) | |
| 884 builder.set_dhcp_fetcher_factory( | |
| 885 base::MakeUnique<chromeos::DhcpProxyScriptFetcherFactoryChromeos>()); | |
| 886 #endif | |
| 887 builder.set_proxy_config_service(std::move(system_proxy_config_service_)); | |
|
mmenke
2017/06/10 01:37:41
These two blocks are basically inlining ProxyServi
| |
| 901 | 888 |
| 902 net::HttpNetworkSession::Context session_context; | 889 builder.set_http_network_session_params(session_params_); |
| 903 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( | |
| 904 context, &session_context); | |
| 905 | 890 |
| 906 context_storage->set_http_network_session( | 891 builder.set_data_enabled(true); |
| 907 base::MakeUnique<net::HttpNetworkSession>(session_params_, | 892 builder.set_file_enabled(true); |
| 908 session_context)); | |
| 909 context_storage->set_http_transaction_factory( | |
| 910 base::MakeUnique<net::HttpNetworkLayer>( | |
| 911 context_storage->http_network_session())); | |
| 912 | |
| 913 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | |
| 914 new net::URLRequestJobFactoryImpl()); | |
| 915 | |
| 916 job_factory->SetProtocolHandler(url::kDataScheme, | |
| 917 base::MakeUnique<net::DataProtocolHandler>()); | |
| 918 job_factory->SetProtocolHandler( | |
| 919 url::kFileScheme, | |
| 920 base::MakeUnique<net::FileProtocolHandler>( | |
| 921 base::CreateTaskRunnerWithTraits( | |
| 922 {base::MayBlock(), base::TaskPriority::USER_VISIBLE, | |
| 923 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))); | |
| 924 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) | 893 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) |
| 925 job_factory->SetProtocolHandler( | 894 builder.set_ftp_enabled(true); |
| 926 url::kFtpScheme, | |
| 927 net::FtpProtocolHandler::Create(context->host_resolver())); | |
| 928 #endif | 895 #endif |
| 929 | 896 |
| 930 context_storage->set_job_factory(std::move(job_factory)); | 897 globals_->system_request_context = builder.Build(); |
| 931 } | 898 } |
| 932 | 899 |
| 933 // static | 900 // static |
| 934 void IOThread::ConfigureParamsFromFieldTrialsAndCommandLine( | 901 void IOThread::ConfigureParamsFromFieldTrialsAndCommandLine( |
| 935 const base::CommandLine& command_line, | 902 const base::CommandLine& command_line, |
| 936 bool is_quic_allowed_by_policy, | 903 bool is_quic_allowed_by_policy, |
| 937 bool http_09_on_non_default_ports_enabled, | 904 bool http_09_on_non_default_ports_enabled, |
| 938 net::HttpNetworkSession::Params* params) { | 905 net::HttpNetworkSession::Params* params) { |
| 939 std::string quic_user_agent_id = chrome::GetChannelString(); | 906 std::string quic_user_agent_id = chrome::GetChannelString(); |
| 940 if (!quic_user_agent_id.empty()) | 907 if (!quic_user_agent_id.empty()) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1020 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); | 987 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); |
| 1021 } | 988 } |
| 1022 | 989 |
| 1023 params->http_09_on_non_default_ports_enabled = | 990 params->http_09_on_non_default_ports_enabled = |
| 1024 http_09_on_non_default_ports_enabled; | 991 http_09_on_non_default_ports_enabled; |
| 1025 } | 992 } |
| 1026 | 993 |
| 1027 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { | 994 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { |
| 1028 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); | 995 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); |
| 1029 } | 996 } |
| OLD | NEW |