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/browser/network_session_config urator.h" | 57 #include "components/network_session_configurator/browser/network_session_config urator.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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 host_cache->ClearForHosts(host_filter); | 749 host_cache->ClearForHosts(host_filter); |
756 } | 750 } |
757 | 751 |
758 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { | 752 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { |
759 return session_params_; | 753 return session_params_; |
760 } | 754 } |
761 | 755 |
762 void IOThread::DisableQuic() { | 756 void IOThread::DisableQuic() { |
763 session_params_.enable_quic = false; | 757 session_params_.enable_quic = false; |
764 | 758 |
765 if (globals_->system_request_context_storage) | 759 if (globals_->system_request_context) |
766 globals_->system_request_context_storage->http_network_session() | 760 globals_->system_request_context->http_transaction_factory() |
761 ->GetSession() | |
767 ->DisableQuic(); | 762 ->DisableQuic(); |
768 } | 763 } |
769 | 764 |
770 base::TimeTicks IOThread::creation_time() const { | 765 base::TimeTicks IOThread::creation_time() const { |
771 return creation_time_; | 766 return creation_time_; |
772 } | 767 } |
773 | 768 |
774 net::SSLConfigService* IOThread::GetSSLConfigService() { | 769 net::SSLConfigService* IOThread::GetSSLConfigService() { |
775 return ssl_config_service_manager_->Get(); | 770 return ssl_config_service_manager_->Get(); |
776 } | 771 } |
(...skipping 23 matching lines...) Expand all Loading... | |
800 return quick_check_enabled_.GetValue(); | 795 return quick_check_enabled_.GetValue(); |
801 } | 796 } |
802 | 797 |
803 bool IOThread::PacHttpsUrlStrippingEnabled() const { | 798 bool IOThread::PacHttpsUrlStrippingEnabled() const { |
804 return pac_https_url_stripping_enabled_.GetValue(); | 799 return pac_https_url_stripping_enabled_.GetValue(); |
805 } | 800 } |
806 | 801 |
807 void IOThread::ConstructSystemRequestContext() { | 802 void IOThread::ConstructSystemRequestContext() { |
808 const base::CommandLine& command_line = | 803 const base::CommandLine& command_line = |
809 *base::CommandLine::ForCurrentProcess(); | 804 *base::CommandLine::ForCurrentProcess(); |
805 net::URLRequestContextBuilderMojo builder; | |
810 | 806 |
811 globals_->system_request_context = | 807 builder.set_network_quality_estimator( |
812 base::MakeUnique<SystemURLRequestContext>(); | 808 globals_->network_quality_estimator.get()); |
813 net::URLRequestContext* context = globals_->system_request_context.get(); | 809 builder.set_enable_brotli(globals_->enable_brotli); |
814 globals_->system_request_context_storage = | 810 builder.set_name("system"); |
815 base::MakeUnique<net::URLRequestContextStorage>(context); | |
816 net::URLRequestContextStorage* context_storage = | |
817 globals_->system_request_context_storage.get(); | |
818 | 811 |
819 context->set_network_quality_estimator( | 812 builder.set_user_agent(GetUserAgent()); |
820 globals_->network_quality_estimator.get()); | |
821 context->set_enable_brotli(globals_->enable_brotli); | |
822 context->set_name("system"); | |
823 | |
824 context_storage->set_http_user_agent_settings( | |
825 base::MakeUnique<net::StaticHttpUserAgentSettings>(std::string(), | |
826 GetUserAgent())); | |
827 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate( | 813 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate( |
828 new ChromeNetworkDelegate(extension_event_router_forwarder(), | 814 new ChromeNetworkDelegate(extension_event_router_forwarder(), |
829 &system_enable_referrers_)); | 815 &system_enable_referrers_)); |
830 // By default, data usage is considered off the record. | 816 // By default, data usage is considered off the record. |
831 chrome_network_delegate->set_data_use_aggregator( | 817 chrome_network_delegate->set_data_use_aggregator( |
832 globals_->data_use_aggregator.get(), | 818 globals_->data_use_aggregator.get(), |
833 true /* is_data_usage_off_the_record */); | 819 true /* is_data_usage_off_the_record */); |
834 context_storage->set_network_delegate( | 820 builder.set_network_delegate( |
835 globals_->data_use_ascriber->CreateNetworkDelegate( | 821 globals_->data_use_ascriber->CreateNetworkDelegate( |
836 std::move(chrome_network_delegate), GetMetricsDataUseForwarder())); | 822 std::move(chrome_network_delegate), GetMetricsDataUseForwarder())); |
837 context->set_net_log(net_log_); | 823 builder.set_net_log(net_log_); |
838 context_storage->set_host_resolver(CreateGlobalHostResolver(net_log_)); | 824 std::unique_ptr<net::HostResolver> host_resolver( |
825 CreateGlobalHostResolver(net_log_)); | |
839 | 826 |
840 context_storage->set_ssl_config_service(GetSSLConfigService()); | 827 builder.set_ssl_config_service(GetSSLConfigService()); |
841 context_storage->set_http_auth_handler_factory( | 828 builder.SetHttpAuthHandlerFactory( |
842 CreateDefaultAuthHandlerFactory(context->host_resolver())); | 829 CreateDefaultAuthHandlerFactory(host_resolver.get())); |
Randy Smith (Not in Mondays)
2017/06/13 16:42:14
nit, random thought, not necessary for this CL: Wo
mmenke
2017/06/13 17:02:22
This is an IOThread method, not a net one, and dep
| |
843 | 830 |
844 // In-memory cookie store. | 831 builder.set_host_resolver(std::move(host_resolver)); |
845 context_storage->set_cookie_store( | |
846 content::CreateCookieStore(content::CookieStoreConfig())); | |
847 // In-memory channel ID store. | |
848 context_storage->set_channel_id_service( | |
849 base::MakeUnique<net::ChannelIDService>( | |
850 new net::DefaultChannelIDStore(nullptr))); | |
851 context->cookie_store()->SetChannelIDServiceID( | |
852 context->channel_id_service()->GetUniqueID()); | |
853 | |
854 context_storage->set_transport_security_state( | |
855 base::MakeUnique<net::TransportSecurityState>()); | |
856 | |
857 context_storage->set_http_server_properties( | |
858 base::MakeUnique<net::HttpServerPropertiesImpl>()); | |
859 | 832 |
860 #if defined(OS_CHROMEOS) | 833 #if defined(OS_CHROMEOS) |
861 // Creates a CertVerifyProc that doesn't allow any profile-provided certs. | 834 // Creates a CertVerifyProc that doesn't allow any profile-provided certs. |
862 context_storage->set_cert_verifier(base::MakeUnique<net::CachingCertVerifier>( | 835 builder.SetCertVerifier(base::MakeUnique<net::CachingCertVerifier>( |
863 base::MakeUnique<net::MultiThreadedCertVerifier>( | 836 base::MakeUnique<net::MultiThreadedCertVerifier>( |
864 new chromeos::CertVerifyProcChromeOS()))); | 837 new chromeos::CertVerifyProcChromeOS()))); |
865 #else | 838 #else |
866 context_storage->set_cert_verifier( | 839 builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( |
867 IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( | 840 command_line, net::CertVerifier::CreateDefault())); |
868 command_line, net::CertVerifier::CreateDefault())); | |
869 UMA_HISTOGRAM_BOOLEAN( | 841 UMA_HISTOGRAM_BOOLEAN( |
870 "Net.Certificate.IgnoreCertificateErrorsSPKIListPresent", | 842 "Net.Certificate.IgnoreCertificateErrorsSPKIListPresent", |
871 command_line.HasSwitch(switches::kIgnoreCertificateErrorsSPKIList)); | 843 command_line.HasSwitch(switches::kIgnoreCertificateErrorsSPKIList)); |
872 #endif | 844 #endif |
873 | 845 |
874 std::unique_ptr<net::MultiLogCTVerifier> ct_verifier = | 846 std::unique_ptr<net::MultiLogCTVerifier> ct_verifier = |
875 base::MakeUnique<net::MultiLogCTVerifier>(); | 847 base::MakeUnique<net::MultiLogCTVerifier>(); |
876 // Add built-in logs | 848 // Add built-in logs |
877 ct_verifier->AddLogs(globals_->ct_logs); | 849 ct_verifier->AddLogs(globals_->ct_logs); |
878 | 850 |
879 // Register the ct_tree_tracker_ as observer for verified SCTs. | 851 // Register the ct_tree_tracker_ as observer for verified SCTs. |
880 ct_verifier->SetObserver(ct_tree_tracker_.get()); | 852 ct_verifier->SetObserver(ct_tree_tracker_.get()); |
881 | 853 |
882 context_storage->set_cert_transparency_verifier(std::move(ct_verifier)); | 854 builder.set_ct_verifier(std::move(ct_verifier)); |
883 | 855 |
884 context_storage->set_ct_policy_enforcer( | 856 // TODO(eroman): Figure out why this doesn't work in single-process mode. |
885 base::MakeUnique<net::CTPolicyEnforcer>()); | 857 // Should be possible now that a private isolate is used. |
858 // http://crbug.com/474654 | |
Randy Smith (Not in Mondays)
2017/06/13 16:42:15
Sorry, I poked around a bit but eventually decided
mmenke
2017/06/13 17:02:21
There was a comment about that in the previous pat
| |
859 if (!command_line.HasSwitch(switches::kWinHttpProxyResolver)) { | |
860 if (command_line.HasSwitch(switches::kSingleProcess)) { | |
861 LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode."; | |
862 } else { | |
863 builder.set_mojo_proxy_resolver_factory( | |
864 ChromeMojoProxyResolverFactory::GetInstance()); | |
865 } | |
866 } | |
886 | 867 |
887 context_storage->set_proxy_service(ProxyServiceFactory::CreateProxyService( | 868 builder.set_pac_quick_check_enabled(WpadQuickCheckEnabled()); |
888 net_log_, context, context->network_delegate(), | 869 builder.set_pac_sanitize_url_policy( |
889 std::move(system_proxy_config_service_), command_line, | 870 PacHttpsUrlStrippingEnabled() |
890 WpadQuickCheckEnabled(), PacHttpsUrlStrippingEnabled())); | 871 ? net::ProxyService::SanitizeUrlPolicy::SAFE |
872 : net::ProxyService::SanitizeUrlPolicy::UNSAFE); | |
873 #if defined(OS_CHROMEOS) | |
874 builder.set_dhcp_fetcher_factory( | |
875 base::MakeUnique<chromeos::DhcpProxyScriptFetcherFactoryChromeos>()); | |
876 #endif | |
877 builder.set_proxy_config_service(std::move(system_proxy_config_service_)); | |
891 | 878 |
892 net::HttpNetworkSession::Context session_context; | 879 builder.set_http_network_session_params(session_params_); |
893 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( | |
894 context, &session_context); | |
895 | 880 |
896 context_storage->set_http_network_session( | 881 builder.set_data_enabled(true); |
897 base::MakeUnique<net::HttpNetworkSession>(session_params_, | 882 builder.set_file_enabled(true); |
898 session_context)); | |
899 context_storage->set_http_transaction_factory( | |
900 base::MakeUnique<net::HttpNetworkLayer>( | |
901 context_storage->http_network_session())); | |
902 | |
903 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | |
904 new net::URLRequestJobFactoryImpl()); | |
905 | |
906 job_factory->SetProtocolHandler(url::kDataScheme, | |
907 base::MakeUnique<net::DataProtocolHandler>()); | |
Randy Smith (Not in Mondays)
2017/06/13 16:42:15
nit, not sure if it should be in this CL: The code
mmenke
2017/06/13 17:02:21
Sure, I'll update it in another CL. net can certa
| |
908 job_factory->SetProtocolHandler( | |
909 url::kFileScheme, | |
910 base::MakeUnique<net::FileProtocolHandler>( | |
911 base::CreateTaskRunnerWithTraits( | |
912 {base::MayBlock(), base::TaskPriority::USER_VISIBLE, | |
913 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))); | |
Randy Smith (Not in Mondays)
2017/06/13 16:42:15
So the conversion to using URLRequestContextBuilde
mmenke
2017/06/13 17:02:22
Good point, completely forgot about that. I'll up
mmenke
2017/06/13 17:34:41
Actually, I'm going to set the task runner via the
| |
914 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) | 883 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) |
915 job_factory->SetProtocolHandler( | 884 builder.set_ftp_enabled(true); |
916 url::kFtpScheme, | |
917 net::FtpProtocolHandler::Create(context->host_resolver())); | |
918 #endif | 885 #endif |
919 | 886 |
920 context_storage->set_job_factory(std::move(job_factory)); | 887 globals_->system_request_context = builder.Build(); |
921 } | 888 } |
922 | 889 |
923 // static | 890 // static |
924 void IOThread::ConfigureParamsFromFieldTrialsAndCommandLine( | 891 void IOThread::ConfigureParamsFromFieldTrialsAndCommandLine( |
925 const base::CommandLine& command_line, | 892 const base::CommandLine& command_line, |
926 bool is_quic_allowed_by_policy, | 893 bool is_quic_allowed_by_policy, |
927 bool http_09_on_non_default_ports_enabled, | 894 bool http_09_on_non_default_ports_enabled, |
928 net::HttpNetworkSession::Params* params) { | 895 net::HttpNetworkSession::Params* params) { |
929 std::string quic_user_agent_id = chrome::GetChannelString(); | 896 std::string quic_user_agent_id = chrome::GetChannelString(); |
930 if (!quic_user_agent_id.empty()) | 897 if (!quic_user_agent_id.empty()) |
931 quic_user_agent_id.push_back(' '); | 898 quic_user_agent_id.push_back(' '); |
932 quic_user_agent_id.append( | 899 quic_user_agent_id.append( |
933 version_info::GetProductNameAndVersionForUserAgent()); | 900 version_info::GetProductNameAndVersionForUserAgent()); |
934 quic_user_agent_id.push_back(' '); | 901 quic_user_agent_id.push_back(' '); |
935 quic_user_agent_id.append(content::BuildOSCpuInfo()); | 902 quic_user_agent_id.append(content::BuildOSCpuInfo()); |
936 | 903 |
937 network_session_configurator::ParseCommandLineAndFieldTrials( | 904 network_session_configurator::ParseCommandLineAndFieldTrials( |
938 command_line, !is_quic_allowed_by_policy, quic_user_agent_id, params); | 905 command_line, !is_quic_allowed_by_policy, quic_user_agent_id, params); |
939 | 906 |
940 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) | 907 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) |
941 net::URLFetcher::SetIgnoreCertificateRequests(true); | 908 net::URLFetcher::SetIgnoreCertificateRequests(true); |
942 | 909 |
943 params->http_09_on_non_default_ports_enabled = | 910 params->http_09_on_non_default_ports_enabled = |
944 http_09_on_non_default_ports_enabled; | 911 http_09_on_non_default_ports_enabled; |
945 } | 912 } |
946 | 913 |
947 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { | 914 metrics::UpdateUsagePrefCallbackType IOThread::GetMetricsDataUseForwarder() { |
948 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); | 915 return base::Bind(&UpdateMetricsUsagePrefsOnUIThread); |
949 } | 916 } |
OLD | NEW |