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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "chrome/common/channel_info.h" | 43 #include "chrome/common/channel_info.h" |
44 #include "chrome/common/chrome_content_client.h" | 44 #include "chrome/common/chrome_content_client.h" |
45 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
46 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 47 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
48 #include "components/data_usage/core/data_use_aggregator.h" | 48 #include "components/data_usage/core/data_use_aggregator.h" |
49 #include "components/data_usage/core/data_use_amortizer.h" | 49 #include "components/data_usage/core/data_use_amortizer.h" |
50 #include "components/data_usage/core/data_use_annotator.h" | 50 #include "components/data_usage/core/data_use_annotator.h" |
51 #include "components/metrics/metrics_service.h" | 51 #include "components/metrics/metrics_service.h" |
52 #include "components/net_log/chrome_net_log.h" | 52 #include "components/net_log/chrome_net_log.h" |
| 53 #include "components/network_session_configurator/network_session_configurator.h
" |
53 #include "components/policy/core/common/policy_service.h" | 54 #include "components/policy/core/common/policy_service.h" |
54 #include "components/prefs/pref_registry_simple.h" | 55 #include "components/prefs/pref_registry_simple.h" |
55 #include "components/prefs/pref_service.h" | 56 #include "components/prefs/pref_service.h" |
56 #include "components/proxy_config/pref_proxy_config_tracker.h" | 57 #include "components/proxy_config/pref_proxy_config_tracker.h" |
57 #include "components/variations/variations_associated_data.h" | 58 #include "components/variations/variations_associated_data.h" |
58 #include "components/version_info/version_info.h" | 59 #include "components/version_info/version_info.h" |
59 #include "content/public/browser/browser_thread.h" | 60 #include "content/public/browser/browser_thread.h" |
60 #include "content/public/browser/cookie_store_factory.h" | 61 #include "content/public/browser/cookie_store_factory.h" |
61 #include "content/public/common/content_features.h" | 62 #include "content/public/common/content_features.h" |
62 #include "content/public/common/content_switches.h" | 63 #include "content/public/common/content_switches.h" |
(...skipping 17 matching lines...) Expand all Loading... |
80 #include "net/http/http_auth_filter.h" | 81 #include "net/http/http_auth_filter.h" |
81 #include "net/http/http_auth_handler_factory.h" | 82 #include "net/http/http_auth_handler_factory.h" |
82 #include "net/http/http_auth_preferences.h" | 83 #include "net/http/http_auth_preferences.h" |
83 #include "net/http/http_network_layer.h" | 84 #include "net/http/http_network_layer.h" |
84 #include "net/http/http_server_properties_impl.h" | 85 #include "net/http/http_server_properties_impl.h" |
85 #include "net/nqe/external_estimate_provider.h" | 86 #include "net/nqe/external_estimate_provider.h" |
86 #include "net/nqe/network_quality_estimator.h" | 87 #include "net/nqe/network_quality_estimator.h" |
87 #include "net/proxy/proxy_config_service.h" | 88 #include "net/proxy/proxy_config_service.h" |
88 #include "net/proxy/proxy_script_fetcher_impl.h" | 89 #include "net/proxy/proxy_script_fetcher_impl.h" |
89 #include "net/proxy/proxy_service.h" | 90 #include "net/proxy/proxy_service.h" |
90 #include "net/quic/crypto/crypto_protocol.h" | |
91 #include "net/quic/quic_protocol.h" | |
92 #include "net/quic/quic_utils.h" | |
93 #include "net/socket/ssl_client_socket.h" | 91 #include "net/socket/ssl_client_socket.h" |
94 #include "net/socket/tcp_client_socket.h" | 92 #include "net/socket/tcp_client_socket.h" |
95 #include "net/spdy/spdy_session.h" | |
96 #include "net/ssl/channel_id_service.h" | 93 #include "net/ssl/channel_id_service.h" |
97 #include "net/ssl/default_channel_id_store.h" | 94 #include "net/ssl/default_channel_id_store.h" |
98 #include "net/url_request/data_protocol_handler.h" | 95 #include "net/url_request/data_protocol_handler.h" |
99 #include "net/url_request/file_protocol_handler.h" | 96 #include "net/url_request/file_protocol_handler.h" |
100 #include "net/url_request/ftp_protocol_handler.h" | 97 #include "net/url_request/ftp_protocol_handler.h" |
101 #include "net/url_request/static_http_user_agent_settings.h" | 98 #include "net/url_request/static_http_user_agent_settings.h" |
102 #include "net/url_request/url_fetcher.h" | 99 #include "net/url_request/url_fetcher.h" |
103 #include "net/url_request/url_request_backoff_manager.h" | 100 #include "net/url_request/url_request_backoff_manager.h" |
104 #include "net/url_request/url_request_context.h" | 101 #include "net/url_request/url_request_context.h" |
105 #include "net/url_request/url_request_context_builder.h" | 102 #include "net/url_request/url_request_context_builder.h" |
(...skipping 29 matching lines...) Expand all Loading... |
135 | 132 |
136 using content::BrowserThread; | 133 using content::BrowserThread; |
137 | 134 |
138 class SafeBrowsingURLRequestContext; | 135 class SafeBrowsingURLRequestContext; |
139 | 136 |
140 // The IOThread object must outlive any tasks posted to the IO thread before the | 137 // The IOThread object must outlive any tasks posted to the IO thread before the |
141 // Quit task, so base::Bind() calls are not refcounted. | 138 // Quit task, so base::Bind() calls are not refcounted. |
142 | 139 |
143 namespace { | 140 namespace { |
144 | 141 |
145 const char kTCPFastOpenFieldTrialName[] = "TCPFastOpen"; | |
146 const char kTCPFastOpenHttpsEnabledGroupName[] = "HttpsEnabled"; | |
147 | |
148 const char kQuicFieldTrialName[] = "QUIC"; | |
149 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; | |
150 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; | |
151 | |
152 // The SPDY trial composes two different trial plus control groups: | |
153 // * A "holdback" group with SPDY disabled, and corresponding control | |
154 // (SPDY/3.1). The primary purpose of the holdback group is to encourage site | |
155 // operators to do feature detection rather than UA-sniffing. As such, this | |
156 // trial runs continuously. | |
157 // * A SPDY/4 experiment, for SPDY/4 (aka HTTP/2) vs SPDY/3.1 comparisons and | |
158 // eventual SPDY/4 deployment. | |
159 const char kSpdyFieldTrialName[] = "SPDY"; | |
160 const char kSpdyFieldTrialHoldbackGroupNamePrefix[] = "SpdyDisabled"; | |
161 const char kSpdyFieldTrialSpdy31GroupNamePrefix[] = "Spdy31Enabled"; | |
162 const char kSpdyFieldTrialSpdy4GroupNamePrefix[] = "Spdy4Enabled"; | |
163 const char kSpdyFieldTrialParametrizedPrefix[] = "Parametrized"; | |
164 | |
165 // The AltSvc trial controls whether Alt-Svc headers are parsed. | |
166 // Disabled: | |
167 // Alt-Svc headers are not parsed. | |
168 // Alternate-Protocol headers are parsed. | |
169 // Enabled: | |
170 // Alt-Svc headers are parsed, but only same-host entries are used by | |
171 // default. (Use "enable_alternative_service_with_different_host" QUIC | |
172 // parameter to enable entries with different hosts.) | |
173 // Alternate-Protocol headers are ignored for responses that have an Alt-Svc | |
174 // header. | |
175 const char kAltSvcFieldTrialName[] = "ParseAltSvc"; | |
176 const char kAltSvcFieldTrialDisabledPrefix[] = "AltSvcDisabled"; | |
177 const char kAltSvcFieldTrialEnabledPrefix[] = "AltSvcEnabled"; | |
178 | |
179 // Field trial for network quality estimator. Seeds RTT and downstream | 142 // Field trial for network quality estimator. Seeds RTT and downstream |
180 // throughput observations with values that correspond to the connection type | 143 // throughput observations with values that correspond to the connection type |
181 // determined by the operating system. | 144 // determined by the operating system. |
182 const char kNetworkQualityEstimatorFieldTrialName[] = "NetworkQualityEstimator"; | 145 const char kNetworkQualityEstimatorFieldTrialName[] = "NetworkQualityEstimator"; |
183 | 146 |
184 // Field trial for NPN. | |
185 const char kNpnTrialName[] = "NPN"; | |
186 const char kNpnTrialEnabledGroupNamePrefix[] = "Enable"; | |
187 const char kNpnTrialDisabledGroupNamePrefix[] = "Disable"; | |
188 | |
189 // Field trial for priority dependencies. | |
190 const char kSpdyDependenciesFieldTrial[] = "SpdyEnableDependencies"; | |
191 const char kSpdyDependenciesFieldTrialEnable[] = "Enable"; | |
192 const char kSpdyDepencenciesFieldTrialDisable[] = "Disable"; | |
193 | |
194 #if defined(OS_MACOSX) | 147 #if defined(OS_MACOSX) |
195 void ObserveKeychainEvents() { | 148 void ObserveKeychainEvents() { |
196 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 149 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
197 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); | 150 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); |
198 } | 151 } |
199 #endif | 152 #endif |
200 | 153 |
201 // Gets file path into ssl_keylog_file from command line argument or | 154 // Gets file path into ssl_keylog_file from command line argument or |
202 // environment variable. Command line argument has priority when | 155 // environment variable. Command line argument has priority when |
203 // both specified. | 156 // both specified. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (!command_line.HasSwitch(switches::kHostResolverRules)) | 229 if (!command_line.HasSwitch(switches::kHostResolverRules)) |
277 return global_host_resolver; | 230 return global_host_resolver; |
278 | 231 |
279 std::unique_ptr<net::MappedHostResolver> remapped_resolver( | 232 std::unique_ptr<net::MappedHostResolver> remapped_resolver( |
280 new net::MappedHostResolver(std::move(global_host_resolver))); | 233 new net::MappedHostResolver(std::move(global_host_resolver))); |
281 remapped_resolver->SetRulesFromString( | 234 remapped_resolver->SetRulesFromString( |
282 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); | 235 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); |
283 return std::move(remapped_resolver); | 236 return std::move(remapped_resolver); |
284 } | 237 } |
285 | 238 |
286 int GetSwitchValueAsInt(const base::CommandLine& command_line, | |
287 const std::string& switch_name) { | |
288 int value; | |
289 if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), | |
290 &value)) { | |
291 return 0; | |
292 } | |
293 return value; | |
294 } | |
295 | |
296 // Returns the value associated with |key| in |params| or "" if the | |
297 // key is not present in the map. | |
298 const std::string& GetVariationParam( | |
299 const std::map<std::string, std::string>& params, | |
300 const std::string& key) { | |
301 std::map<std::string, std::string>::const_iterator it = params.find(key); | |
302 if (it == params.end()) | |
303 return base::EmptyString(); | |
304 | |
305 return it->second; | |
306 } | |
307 | |
308 } // namespace | 239 } // namespace |
309 | 240 |
310 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { | 241 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { |
311 public: | 242 public: |
312 explicit SystemURLRequestContextGetter(IOThread* io_thread); | 243 explicit SystemURLRequestContextGetter(IOThread* io_thread); |
313 | 244 |
314 // Implementation for net::UrlRequestContextGetter. | 245 // Implementation for net::UrlRequestContextGetter. |
315 net::URLRequestContext* GetURLRequestContext() override; | 246 net::URLRequestContext* GetURLRequestContext() override; |
316 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 247 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
317 const override; | 248 const override; |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 params_.enable_token_binding = | 687 params_.enable_token_binding = |
757 base::FeatureList::IsEnabled(features::kTokenBinding); | 688 base::FeatureList::IsEnabled(features::kTokenBinding); |
758 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 689 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
759 // is fixed. | 690 // is fixed. |
760 tracked_objects::ScopedTracker tracking_profile13( | 691 tracked_objects::ScopedTracker tracking_profile13( |
761 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 692 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
762 "466432 IOThread::InitAsync::InitializeNetworkOptions")); | 693 "466432 IOThread::InitAsync::InitializeNetworkOptions")); |
763 // TODO(rch): Make the client socket factory a per-network session instance, | 694 // TODO(rch): Make the client socket factory a per-network session instance, |
764 // constructed from a NetworkSession::Params, to allow us to move this option | 695 // constructed from a NetworkSession::Params, to allow us to move this option |
765 // to IOThread::Globals & HttpNetworkSession::Params. | 696 // to IOThread::Globals & HttpNetworkSession::Params. |
766 network_session_configurator_.ParseFieldTrialsAndCommandLine( | 697 std::string quic_user_agent_id = chrome::GetChannelString(); |
767 is_spdy_allowed_by_policy_, is_quic_allowed_by_policy_, ¶ms_); | 698 if (!quic_user_agent_id.empty()) |
| 699 quic_user_agent_id.push_back(' '); |
| 700 quic_user_agent_id.append( |
| 701 version_info::GetProductNameAndVersionForUserAgent()); |
| 702 quic_user_agent_id.push_back(' '); |
| 703 quic_user_agent_id.append(content::BuildOSCpuInfo()); |
| 704 network_session_configurator::ParseFieldTrialsAndCommandLine( |
| 705 is_spdy_allowed_by_policy_, is_quic_allowed_by_policy_, |
| 706 quic_user_agent_id, ¶ms_); |
| 707 |
768 bool always_enable_tfo_if_supported = | 708 bool always_enable_tfo_if_supported = |
769 command_line.HasSwitch(switches::kEnableTcpFastOpen); | 709 command_line.HasSwitch(switches::kEnableTcpFastOpen); |
770 // Check for OS support of TCP FastOpen, and turn it on for all connections if | 710 // Check for OS support of TCP FastOpen, and turn it on for all connections if |
771 // indicated by user. | 711 // indicated by user. |
772 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); | 712 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_tfo_if_supported); |
773 | 713 |
774 TRACE_EVENT_BEGIN0("startup", | 714 TRACE_EVENT_BEGIN0("startup", |
775 "IOThread::Init:ProxyScriptFetcherRequestContext"); | 715 "IOThread::Init:ProxyScriptFetcherRequestContext"); |
776 globals_->proxy_script_fetcher_context.reset( | 716 globals_->proxy_script_fetcher_context.reset( |
777 ConstructProxyScriptFetcherContext(globals_, params_, net_log_)); | 717 ConstructProxyScriptFetcherContext(globals_, params_, net_log_)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 network_change_observer_.reset(); | 776 network_change_observer_.reset(); |
837 | 777 |
838 system_proxy_config_service_.reset(); | 778 system_proxy_config_service_.reset(); |
839 delete globals_; | 779 delete globals_; |
840 globals_ = NULL; | 780 globals_ = NULL; |
841 | 781 |
842 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); | 782 base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); |
843 } | 783 } |
844 | 784 |
845 // static | 785 // static |
846 void IOThread::NetworkSessionConfigurator::ParseFieldTrials( | |
847 bool is_spdy_allowed_by_policy, | |
848 bool is_quic_allowed_by_policy, | |
849 net::HttpNetworkSession::Params* params) { | |
850 const base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | |
851 ParseFieldTrialsAndCommandLineInternal(command_line, | |
852 is_spdy_allowed_by_policy, | |
853 is_quic_allowed_by_policy, params); | |
854 } | |
855 | |
856 // static | |
857 void IOThread::NetworkSessionConfigurator::ParseFieldTrialsAndCommandLine( | |
858 bool is_spdy_allowed_by_policy, | |
859 bool is_quic_allowed_by_policy, | |
860 net::HttpNetworkSession::Params* params) { | |
861 const base::CommandLine& command_line = | |
862 *base::CommandLine::ForCurrentProcess(); | |
863 ParseFieldTrialsAndCommandLineInternal(command_line, | |
864 is_spdy_allowed_by_policy, | |
865 is_quic_allowed_by_policy, params); | |
866 } | |
867 | |
868 // static | |
869 void IOThread::NetworkSessionConfigurator:: | |
870 ParseFieldTrialsAndCommandLineInternal( | |
871 const base::CommandLine& command_line, | |
872 bool is_spdy_allowed_by_policy, | |
873 bool is_quic_allowed_by_policy, | |
874 net::HttpNetworkSession::Params* params) { | |
875 // Parameters only controlled by command line. | |
876 if (command_line.HasSwitch(switches::kIgnoreCertificateErrors)) | |
877 params->ignore_certificate_errors = true; | |
878 if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { | |
879 params->testing_fixed_http_port = | |
880 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort); | |
881 } | |
882 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { | |
883 params->testing_fixed_https_port = | |
884 GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); | |
885 } | |
886 | |
887 // Always fetch the field trial groups to ensure they are reported correctly. | |
888 // The command line flags will be associated with a group that is reported so | |
889 // long as trial is actually queried. | |
890 | |
891 std::string altsvc_trial_group = | |
892 base::FieldTrialList::FindFullName(kAltSvcFieldTrialName); | |
893 ConfigureAltSvcParams(command_line, altsvc_trial_group, params); | |
894 | |
895 std::string quic_trial_group = | |
896 base::FieldTrialList::FindFullName(kQuicFieldTrialName); | |
897 VariationParameters quic_trial_params; | |
898 if (!variations::GetVariationParams(kQuicFieldTrialName, &quic_trial_params)) | |
899 quic_trial_params.clear(); | |
900 ConfigureQuicParams(command_line, quic_trial_group, quic_trial_params, | |
901 is_quic_allowed_by_policy, params); | |
902 | |
903 if (!is_spdy_allowed_by_policy) { | |
904 base::FieldTrial* trial = base::FieldTrialList::Find(kSpdyFieldTrialName); | |
905 if (trial) | |
906 trial->Disable(); | |
907 } | |
908 std::string spdy_trial_group = | |
909 base::FieldTrialList::FindFullName(kSpdyFieldTrialName); | |
910 VariationParameters spdy_trial_params; | |
911 if (!variations::GetVariationParams(kSpdyFieldTrialName, &spdy_trial_params)) | |
912 spdy_trial_params.clear(); | |
913 ConfigureSpdyParams(command_line, spdy_trial_group, spdy_trial_params, | |
914 is_spdy_allowed_by_policy, params); | |
915 | |
916 const std::string tfo_trial_group = | |
917 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName); | |
918 ConfigureTCPFastOpenParams(tfo_trial_group, params); | |
919 | |
920 std::string npn_trial_group = | |
921 base::FieldTrialList::FindFullName(kNpnTrialName); | |
922 ConfigureNPNParams(command_line, npn_trial_group, params); | |
923 | |
924 std::string priority_dependencies_trial_group = | |
925 base::FieldTrialList::FindFullName(kSpdyDependenciesFieldTrial); | |
926 ConfigurePriorityDependencies(priority_dependencies_trial_group, params); | |
927 } | |
928 | |
929 // static | |
930 void IOThread::NetworkSessionConfigurator::ConfigureTCPFastOpenParams( | |
931 base::StringPiece tfo_trial_group, | |
932 net::HttpNetworkSession::Params* params) { | |
933 if (tfo_trial_group == kTCPFastOpenHttpsEnabledGroupName) | |
934 params->enable_tcp_fast_open_for_ssl = true; | |
935 } | |
936 | |
937 // static | |
938 void IOThread::NetworkSessionConfigurator::ConfigureSpdyParams( | |
939 const base::CommandLine& command_line, | |
940 base::StringPiece spdy_trial_group, | |
941 const VariationParameters& spdy_trial_params, | |
942 bool is_spdy_allowed_by_policy, | |
943 net::HttpNetworkSession::Params* params) { | |
944 // Only handle SPDY field trial parameters and command line flags if | |
945 // "spdy.disabled" preference is not forced via policy. | |
946 if (!is_spdy_allowed_by_policy) { | |
947 params->enable_spdy31 = false; | |
948 params->enable_http2 = false; | |
949 return; | |
950 } | |
951 | |
952 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) | |
953 net::URLFetcher::SetIgnoreCertificateRequests(true); | |
954 | |
955 if (command_line.HasSwitch(switches::kDisableHttp2)) { | |
956 params->enable_spdy31 = false; | |
957 params->enable_http2 = false; | |
958 return; | |
959 } | |
960 | |
961 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) { | |
962 net::HttpStreamFactory::set_spdy_enabled(false); | |
963 return; | |
964 } | |
965 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy31GroupNamePrefix)) { | |
966 params->enable_spdy31 = true; | |
967 params->enable_http2 = false; | |
968 return; | |
969 } | |
970 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { | |
971 params->enable_spdy31 = true; | |
972 params->enable_http2 = true; | |
973 return; | |
974 } | |
975 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { | |
976 bool spdy_enabled = false; | |
977 params->enable_spdy31 = false; | |
978 params->enable_http2 = false; | |
979 if (base::LowerCaseEqualsASCII( | |
980 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { | |
981 spdy_enabled = true; | |
982 params->enable_http2 = true; | |
983 } | |
984 if (base::LowerCaseEqualsASCII( | |
985 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { | |
986 spdy_enabled = true; | |
987 params->enable_spdy31 = true; | |
988 } | |
989 // TODO(bnc): https://crbug.com/521597 | |
990 // HttpStreamFactory::spdy_enabled_ is redundant with params->enable_http2 | |
991 // and enable_spdy31, can it be eliminated? | |
992 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); | |
993 return; | |
994 } | |
995 } | |
996 | |
997 // static | |
998 void IOThread::NetworkSessionConfigurator::ConfigureAltSvcParams( | |
999 const base::CommandLine& command_line, | |
1000 base::StringPiece altsvc_trial_group, | |
1001 net::HttpNetworkSession::Params* params) { | |
1002 if (command_line.HasSwitch(switches::kEnableAlternativeServices) || | |
1003 altsvc_trial_group.starts_with(kAltSvcFieldTrialEnabledPrefix)) { | |
1004 params->parse_alternative_services = true; | |
1005 return; | |
1006 } | |
1007 if (altsvc_trial_group.starts_with(kAltSvcFieldTrialDisabledPrefix)) { | |
1008 params->parse_alternative_services = false; | |
1009 } | |
1010 } | |
1011 | |
1012 // static | |
1013 void IOThread::NetworkSessionConfigurator::ConfigureNPNParams( | |
1014 const base::CommandLine& command_line, | |
1015 base::StringPiece npn_trial_group, | |
1016 net::HttpNetworkSession::Params* params) { | |
1017 if (npn_trial_group.starts_with(kNpnTrialEnabledGroupNamePrefix)) { | |
1018 params->enable_npn = true; | |
1019 } else if (npn_trial_group.starts_with(kNpnTrialDisabledGroupNamePrefix)) { | |
1020 params->enable_npn = false; | |
1021 } | |
1022 } | |
1023 | |
1024 // static | |
1025 void IOThread::NetworkSessionConfigurator::ConfigurePriorityDependencies( | |
1026 base::StringPiece priority_dependencies_trial_group, | |
1027 net::HttpNetworkSession::Params* params) { | |
1028 if (priority_dependencies_trial_group.starts_with( | |
1029 kSpdyDependenciesFieldTrialEnable)) { | |
1030 params->enable_priority_dependencies = true; | |
1031 } else if (priority_dependencies_trial_group.starts_with( | |
1032 kSpdyDepencenciesFieldTrialDisable)) { | |
1033 params->enable_priority_dependencies = false; | |
1034 } | |
1035 } | |
1036 | |
1037 // static | |
1038 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { | 786 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { |
1039 registry->RegisterStringPref(prefs::kAuthSchemes, | 787 registry->RegisterStringPref(prefs::kAuthSchemes, |
1040 "basic,digest,ntlm,negotiate"); | 788 "basic,digest,ntlm,negotiate"); |
1041 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); | 789 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); |
1042 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); | 790 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); |
1043 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); | 791 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); |
1044 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, | 792 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, |
1045 std::string()); | 793 std::string()); |
1046 registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string()); | 794 registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string()); |
1047 registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, | 795 registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 } | 858 } |
1111 | 859 |
1112 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { | 860 const net::HttpNetworkSession::Params& IOThread::NetworkSessionParams() const { |
1113 return params_; | 861 return params_; |
1114 } | 862 } |
1115 | 863 |
1116 base::TimeTicks IOThread::creation_time() const { | 864 base::TimeTicks IOThread::creation_time() const { |
1117 return creation_time_; | 865 return creation_time_; |
1118 } | 866 } |
1119 | 867 |
1120 // static | |
1121 net::SSLConfigService* IOThread::GetSSLConfigService() { | 868 net::SSLConfigService* IOThread::GetSSLConfigService() { |
1122 return ssl_config_service_manager_->Get(); | 869 return ssl_config_service_manager_->Get(); |
1123 } | 870 } |
1124 | 871 |
1125 void IOThread::ChangedToOnTheRecordOnIOThread() { | 872 void IOThread::ChangedToOnTheRecordOnIOThread() { |
1126 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 873 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1127 | 874 |
1128 // Clear the host cache to avoid showing entries from the OTR session | 875 // Clear the host cache to avoid showing entries from the OTR session |
1129 // in about:net-internals. | 876 // in about:net-internals. |
1130 ClearHostCache(); | 877 ClearHostCache(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 | 911 |
1165 globals_->system_request_context.reset( | 912 globals_->system_request_context.reset( |
1166 ConstructSystemRequestContext(globals_, params_, net_log_)); | 913 ConstructSystemRequestContext(globals_, params_, net_log_)); |
1167 } | 914 } |
1168 | 915 |
1169 void IOThread::UpdateDnsClientEnabled() { | 916 void IOThread::UpdateDnsClientEnabled() { |
1170 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 917 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
1171 } | 918 } |
1172 | 919 |
1173 // static | 920 // static |
1174 void IOThread::NetworkSessionConfigurator::ConfigureQuicParams( | |
1175 const base::CommandLine& command_line, | |
1176 base::StringPiece quic_trial_group, | |
1177 const VariationParameters& quic_trial_params, | |
1178 bool is_quic_allowed_by_policy, | |
1179 net::HttpNetworkSession::Params* params) { | |
1180 params->enable_quic = ShouldEnableQuic(command_line, quic_trial_group, | |
1181 is_quic_allowed_by_policy); | |
1182 params->disable_quic_on_timeout_with_open_streams = | |
1183 ShouldDisableQuicWhenConnectionTimesOutWithOpenStreams(quic_trial_params); | |
1184 | |
1185 if (ShouldQuicEnableAlternativeServicesForDifferentHost(command_line, | |
1186 quic_trial_params)) { | |
1187 params->enable_alternative_service_with_different_host = true; | |
1188 params->parse_alternative_services = true; | |
1189 } else { | |
1190 params->enable_alternative_service_with_different_host = false; | |
1191 } | |
1192 | |
1193 if (params->enable_quic) { | |
1194 params->quic_always_require_handshake_confirmation = | |
1195 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params); | |
1196 params->quic_disable_connection_pooling = | |
1197 ShouldQuicDisableConnectionPooling(quic_trial_params); | |
1198 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); | |
1199 if (receive_buffer_size != 0) { | |
1200 params->quic_socket_receive_buffer_size = receive_buffer_size; | |
1201 } | |
1202 params->quic_delay_tcp_race = ShouldQuicDelayTcpRace(quic_trial_params); | |
1203 float load_server_info_timeout_srtt_multiplier = | |
1204 GetQuicLoadServerInfoTimeoutSrttMultiplier(quic_trial_params); | |
1205 if (load_server_info_timeout_srtt_multiplier != 0) { | |
1206 params->quic_load_server_info_timeout_srtt_multiplier = | |
1207 load_server_info_timeout_srtt_multiplier; | |
1208 } | |
1209 params->quic_enable_connection_racing = | |
1210 ShouldQuicEnableConnectionRacing(quic_trial_params); | |
1211 params->quic_enable_non_blocking_io = | |
1212 ShouldQuicEnableNonBlockingIO(quic_trial_params); | |
1213 params->quic_disable_disk_cache = | |
1214 ShouldQuicDisableDiskCache(quic_trial_params); | |
1215 params->quic_prefer_aes = ShouldQuicPreferAes(quic_trial_params); | |
1216 int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections( | |
1217 quic_trial_params); | |
1218 if (max_number_of_lossy_connections != 0) { | |
1219 params->quic_max_number_of_lossy_connections = | |
1220 max_number_of_lossy_connections; | |
1221 } | |
1222 float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params); | |
1223 if (packet_loss_threshold != 0) | |
1224 params->quic_packet_loss_threshold = packet_loss_threshold; | |
1225 params->enable_quic_port_selection = | |
1226 ShouldEnableQuicPortSelection(command_line); | |
1227 params->quic_connection_options = | |
1228 GetQuicConnectionOptions(command_line, quic_trial_params); | |
1229 params->quic_close_sessions_on_ip_change = | |
1230 ShouldQuicCloseSessionsOnIpChange(quic_trial_params); | |
1231 int idle_connection_timeout_seconds = GetQuicIdleConnectionTimeoutSeconds( | |
1232 quic_trial_params); | |
1233 if (idle_connection_timeout_seconds != 0) { | |
1234 params->quic_idle_connection_timeout_seconds = | |
1235 idle_connection_timeout_seconds; | |
1236 } | |
1237 params->quic_disable_preconnect_if_0rtt = | |
1238 ShouldQuicDisablePreConnectIfZeroRtt(quic_trial_params); | |
1239 params->quic_host_whitelist = | |
1240 GetQuicHostWhitelist(command_line, quic_trial_params); | |
1241 params->quic_migrate_sessions_on_network_change = | |
1242 ShouldQuicMigrateSessionsOnNetworkChange(quic_trial_params); | |
1243 params->quic_migrate_sessions_early = | |
1244 ShouldQuicMigrateSessionsEarly(quic_trial_params); | |
1245 } | |
1246 | |
1247 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | |
1248 quic_trial_params); | |
1249 if (max_packet_length != 0) { | |
1250 params->quic_max_packet_length = max_packet_length; | |
1251 } | |
1252 | |
1253 params->quic_user_agent_id = chrome::GetChannelString(); | |
1254 if (!params->quic_user_agent_id.empty()) | |
1255 params->quic_user_agent_id.push_back(' '); | |
1256 params->quic_user_agent_id.append( | |
1257 version_info::GetProductNameAndVersionForUserAgent()); | |
1258 params->quic_user_agent_id.push_back(' '); | |
1259 params->quic_user_agent_id.append(content::BuildOSCpuInfo()); | |
1260 | |
1261 net::QuicVersion version = GetQuicVersion(command_line, quic_trial_params); | |
1262 if (version != net::QUIC_VERSION_UNSUPPORTED) { | |
1263 net::QuicVersionVector supported_versions; | |
1264 supported_versions.push_back(version); | |
1265 params->quic_supported_versions = supported_versions; | |
1266 } | |
1267 | |
1268 if (command_line.HasSwitch(switches::kOriginToForceQuicOn)) { | |
1269 std::string origins = | |
1270 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn); | |
1271 for (const std::string& host_port : base::SplitString( | |
1272 origins, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { | |
1273 net::HostPortPair quic_origin = net::HostPortPair::FromString(host_port); | |
1274 if (!quic_origin.IsEmpty()) | |
1275 params->origins_to_force_quic_on.insert(quic_origin); | |
1276 } | |
1277 } | |
1278 } | |
1279 | |
1280 // static | |
1281 bool IOThread::NetworkSessionConfigurator:: | |
1282 ShouldDisableQuicWhenConnectionTimesOutWithOpenStreams( | |
1283 const VariationParameters& quic_trial_params) { | |
1284 return base::LowerCaseEqualsASCII( | |
1285 GetVariationParam(quic_trial_params, | |
1286 "disable_quic_on_timeout_with_open_streams"), | |
1287 "true"); | |
1288 } | |
1289 | |
1290 // static | |
1291 bool IOThread::NetworkSessionConfigurator::ShouldEnableQuic( | |
1292 const base::CommandLine& command_line, | |
1293 base::StringPiece quic_trial_group, | |
1294 bool is_quic_allowed_by_policy) { | |
1295 if (command_line.HasSwitch(switches::kDisableQuic) || | |
1296 !is_quic_allowed_by_policy) | |
1297 return false; | |
1298 | |
1299 if (command_line.HasSwitch(switches::kEnableQuic)) | |
1300 return true; | |
1301 | |
1302 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || | |
1303 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); | |
1304 } | |
1305 | |
1306 // static | |
1307 bool IOThread::NetworkSessionConfigurator::ShouldEnableQuicPortSelection( | |
1308 const base::CommandLine& command_line) { | |
1309 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | |
1310 return false; | |
1311 | |
1312 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | |
1313 return true; | |
1314 | |
1315 return false; // Default to disabling port selection on all channels. | |
1316 } | |
1317 | |
1318 // static | |
1319 net::QuicTagVector | |
1320 IOThread::NetworkSessionConfigurator::GetQuicConnectionOptions( | |
1321 const base::CommandLine& command_line, | |
1322 const VariationParameters& quic_trial_params) { | |
1323 if (command_line.HasSwitch(switches::kQuicConnectionOptions)) { | |
1324 return net::QuicUtils::ParseQuicConnectionOptions( | |
1325 command_line.GetSwitchValueASCII(switches::kQuicConnectionOptions)); | |
1326 } | |
1327 | |
1328 VariationParameters::const_iterator it = | |
1329 quic_trial_params.find("connection_options"); | |
1330 if (it == quic_trial_params.end()) { | |
1331 return net::QuicTagVector(); | |
1332 } | |
1333 | |
1334 return net::QuicUtils::ParseQuicConnectionOptions(it->second); | |
1335 } | |
1336 | |
1337 // static | |
1338 bool IOThread::NetworkSessionConfigurator:: | |
1339 ShouldQuicAlwaysRequireHandshakeConfirmation( | |
1340 const VariationParameters& quic_trial_params) { | |
1341 return base::LowerCaseEqualsASCII( | |
1342 GetVariationParam(quic_trial_params, | |
1343 "always_require_handshake_confirmation"), | |
1344 "true"); | |
1345 } | |
1346 | |
1347 // static | |
1348 bool IOThread::NetworkSessionConfigurator::ShouldQuicDisableConnectionPooling( | |
1349 const VariationParameters& quic_trial_params) { | |
1350 return base::LowerCaseEqualsASCII( | |
1351 GetVariationParam(quic_trial_params, "disable_connection_pooling"), | |
1352 "true"); | |
1353 } | |
1354 | |
1355 // static | |
1356 float IOThread::NetworkSessionConfigurator:: | |
1357 GetQuicLoadServerInfoTimeoutSrttMultiplier( | |
1358 const VariationParameters& quic_trial_params) { | |
1359 double value; | |
1360 if (base::StringToDouble(GetVariationParam(quic_trial_params, | |
1361 "load_server_info_time_to_srtt"), | |
1362 &value)) { | |
1363 return static_cast<float>(value); | |
1364 } | |
1365 return 0.0f; | |
1366 } | |
1367 | |
1368 // static | |
1369 bool IOThread::NetworkSessionConfigurator::ShouldQuicEnableConnectionRacing( | |
1370 const VariationParameters& quic_trial_params) { | |
1371 return base::LowerCaseEqualsASCII( | |
1372 GetVariationParam(quic_trial_params, "enable_connection_racing"), | |
1373 "true"); | |
1374 } | |
1375 | |
1376 // static | |
1377 bool IOThread::NetworkSessionConfigurator::ShouldQuicEnableNonBlockingIO( | |
1378 const VariationParameters& quic_trial_params) { | |
1379 return base::LowerCaseEqualsASCII( | |
1380 GetVariationParam(quic_trial_params, "enable_non_blocking_io"), | |
1381 "true"); | |
1382 } | |
1383 | |
1384 // static | |
1385 bool IOThread::NetworkSessionConfigurator::ShouldQuicDisableDiskCache( | |
1386 const VariationParameters& quic_trial_params) { | |
1387 return base::LowerCaseEqualsASCII( | |
1388 GetVariationParam(quic_trial_params, "disable_disk_cache"), "true"); | |
1389 } | |
1390 | |
1391 // static | |
1392 bool IOThread::NetworkSessionConfigurator::ShouldQuicPreferAes( | |
1393 const VariationParameters& quic_trial_params) { | |
1394 return base::LowerCaseEqualsASCII( | |
1395 GetVariationParam(quic_trial_params, "prefer_aes"), "true"); | |
1396 } | |
1397 | |
1398 // static | |
1399 bool IOThread::NetworkSessionConfigurator:: | |
1400 ShouldQuicEnableAlternativeServicesForDifferentHost( | |
1401 const base::CommandLine& command_line, | |
1402 const VariationParameters& quic_trial_params) { | |
1403 // TODO(bnc): Remove inaccurately named "use_alternative_services" parameter. | |
1404 return command_line.HasSwitch(switches::kEnableAlternativeServices) || | |
1405 base::LowerCaseEqualsASCII( | |
1406 GetVariationParam(quic_trial_params, "use_alternative_services"), | |
1407 "true") || | |
1408 base::LowerCaseEqualsASCII( | |
1409 GetVariationParam( | |
1410 quic_trial_params, | |
1411 "enable_alternative_service_with_different_host"), | |
1412 "true"); | |
1413 } | |
1414 | |
1415 // static | |
1416 int IOThread::NetworkSessionConfigurator::GetQuicMaxNumberOfLossyConnections( | |
1417 const VariationParameters& quic_trial_params) { | |
1418 int value; | |
1419 if (base::StringToInt(GetVariationParam(quic_trial_params, | |
1420 "max_number_of_lossy_connections"), | |
1421 &value)) { | |
1422 return value; | |
1423 } | |
1424 return 0; | |
1425 } | |
1426 | |
1427 // static | |
1428 float IOThread::NetworkSessionConfigurator::GetQuicPacketLossThreshold( | |
1429 const VariationParameters& quic_trial_params) { | |
1430 double value; | |
1431 if (base::StringToDouble(GetVariationParam(quic_trial_params, | |
1432 "packet_loss_threshold"), | |
1433 &value)) { | |
1434 return static_cast<float>(value); | |
1435 } | |
1436 return 0.0f; | |
1437 } | |
1438 | |
1439 // static | |
1440 int IOThread::NetworkSessionConfigurator::GetQuicSocketReceiveBufferSize( | |
1441 const VariationParameters& quic_trial_params) { | |
1442 int value; | |
1443 if (base::StringToInt(GetVariationParam(quic_trial_params, | |
1444 "receive_buffer_size"), | |
1445 &value)) { | |
1446 return value; | |
1447 } | |
1448 return 0; | |
1449 } | |
1450 | |
1451 // static | |
1452 bool IOThread::NetworkSessionConfigurator::ShouldQuicDelayTcpRace( | |
1453 const VariationParameters& quic_trial_params) { | |
1454 return base::LowerCaseEqualsASCII( | |
1455 GetVariationParam(quic_trial_params, "delay_tcp_race"), "true"); | |
1456 } | |
1457 | |
1458 // static | |
1459 bool IOThread::NetworkSessionConfigurator::ShouldQuicCloseSessionsOnIpChange( | |
1460 const VariationParameters& quic_trial_params) { | |
1461 return base::LowerCaseEqualsASCII( | |
1462 GetVariationParam(quic_trial_params, "close_sessions_on_ip_change"), | |
1463 "true"); | |
1464 } | |
1465 | |
1466 // static | |
1467 int IOThread::NetworkSessionConfigurator::GetQuicIdleConnectionTimeoutSeconds( | |
1468 const VariationParameters& quic_trial_params) { | |
1469 int value; | |
1470 if (base::StringToInt(GetVariationParam(quic_trial_params, | |
1471 "idle_connection_timeout_seconds"), | |
1472 &value)) { | |
1473 return value; | |
1474 } | |
1475 return 0; | |
1476 } | |
1477 | |
1478 // static | |
1479 bool IOThread::NetworkSessionConfigurator::ShouldQuicDisablePreConnectIfZeroRtt( | |
1480 const VariationParameters& quic_trial_params) { | |
1481 return base::LowerCaseEqualsASCII( | |
1482 GetVariationParam(quic_trial_params, "disable_preconnect_if_0rtt"), | |
1483 "true"); | |
1484 } | |
1485 | |
1486 // static | |
1487 std::unordered_set<std::string> | |
1488 IOThread::NetworkSessionConfigurator::GetQuicHostWhitelist( | |
1489 const base::CommandLine& command_line, | |
1490 const VariationParameters& quic_trial_params) { | |
1491 std::string whitelist; | |
1492 if (command_line.HasSwitch(switches::kQuicHostWhitelist)) { | |
1493 whitelist = command_line.GetSwitchValueASCII(switches::kQuicHostWhitelist); | |
1494 } else { | |
1495 whitelist = GetVariationParam(quic_trial_params, "quic_host_whitelist"); | |
1496 } | |
1497 std::unordered_set<std::string> hosts; | |
1498 for (const std::string& host :base::SplitString(whitelist, ",", | |
1499 base::TRIM_WHITESPACE, | |
1500 base::SPLIT_WANT_ALL)) { | |
1501 hosts.insert(host); | |
1502 } | |
1503 return hosts; | |
1504 } | |
1505 | |
1506 // static | |
1507 bool IOThread::NetworkSessionConfigurator:: | |
1508 ShouldQuicMigrateSessionsOnNetworkChange( | |
1509 const VariationParameters& quic_trial_params) { | |
1510 return base::LowerCaseEqualsASCII( | |
1511 GetVariationParam(quic_trial_params, | |
1512 "migrate_sessions_on_network_change"), | |
1513 "true"); | |
1514 } | |
1515 | |
1516 // static | |
1517 bool IOThread::NetworkSessionConfigurator::ShouldQuicMigrateSessionsEarly( | |
1518 const VariationParameters& quic_trial_params) { | |
1519 return base::LowerCaseEqualsASCII( | |
1520 GetVariationParam(quic_trial_params, "migrate_sessions_early"), "true"); | |
1521 } | |
1522 | |
1523 // static | |
1524 size_t IOThread::NetworkSessionConfigurator::GetQuicMaxPacketLength( | |
1525 const base::CommandLine& command_line, | |
1526 const VariationParameters& quic_trial_params) { | |
1527 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | |
1528 unsigned value; | |
1529 if (!base::StringToUint( | |
1530 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | |
1531 &value)) { | |
1532 return 0; | |
1533 } | |
1534 return value; | |
1535 } | |
1536 | |
1537 unsigned value; | |
1538 if (base::StringToUint(GetVariationParam(quic_trial_params, | |
1539 "max_packet_length"), | |
1540 &value)) { | |
1541 return value; | |
1542 } | |
1543 return 0; | |
1544 } | |
1545 | |
1546 // static | |
1547 net::QuicVersion IOThread::NetworkSessionConfigurator::GetQuicVersion( | |
1548 const base::CommandLine& command_line, | |
1549 const VariationParameters& quic_trial_params) { | |
1550 if (command_line.HasSwitch(switches::kQuicVersion)) { | |
1551 return ParseQuicVersion( | |
1552 command_line.GetSwitchValueASCII(switches::kQuicVersion)); | |
1553 } | |
1554 | |
1555 return ParseQuicVersion(GetVariationParam(quic_trial_params, "quic_version")); | |
1556 } | |
1557 | |
1558 // static | |
1559 net::QuicVersion IOThread::NetworkSessionConfigurator::ParseQuicVersion( | |
1560 const std::string& quic_version) { | |
1561 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | |
1562 for (size_t i = 0; i < supported_versions.size(); ++i) { | |
1563 net::QuicVersion version = supported_versions[i]; | |
1564 if (net::QuicVersionToString(version) == quic_version) { | |
1565 return version; | |
1566 } | |
1567 } | |
1568 | |
1569 return net::QUIC_VERSION_UNSUPPORTED; | |
1570 } | |
1571 | |
1572 // static | |
1573 net::URLRequestContext* IOThread::ConstructSystemRequestContext( | 921 net::URLRequestContext* IOThread::ConstructSystemRequestContext( |
1574 IOThread::Globals* globals, | 922 IOThread::Globals* globals, |
1575 const net::HttpNetworkSession::Params& params, | 923 const net::HttpNetworkSession::Params& params, |
1576 net::NetLog* net_log) { | 924 net::NetLog* net_log) { |
1577 net::URLRequestContext* context = new SystemURLRequestContext; | 925 net::URLRequestContext* context = new SystemURLRequestContext; |
1578 context->set_net_log(net_log); | 926 context->set_net_log(net_log); |
1579 context->set_host_resolver(globals->host_resolver.get()); | 927 context->set_host_resolver(globals->host_resolver.get()); |
1580 context->set_cert_verifier(globals->cert_verifier.get()); | 928 context->set_cert_verifier(globals->cert_verifier.get()); |
1581 context->set_transport_security_state( | 929 context->set_transport_security_state( |
1582 globals->transport_security_state.get()); | 930 globals->transport_security_state.get()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1707 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1055 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
1708 // system URLRequestContext too. There's no reason this should be tied to a | 1056 // system URLRequestContext too. There's no reason this should be tied to a |
1709 // profile. | 1057 // profile. |
1710 return context; | 1058 return context; |
1711 } | 1059 } |
1712 | 1060 |
1713 const metrics::UpdateUsagePrefCallbackType& | 1061 const metrics::UpdateUsagePrefCallbackType& |
1714 IOThread::GetMetricsDataUseForwarder() { | 1062 IOThread::GetMetricsDataUseForwarder() { |
1715 return metrics_data_use_forwarder_; | 1063 return metrics_data_use_forwarder_; |
1716 } | 1064 } |
OLD | NEW |