OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 if (option == kExclude) { | 339 if (option == kExclude) { |
340 globals->forced_spdy_exclusions.insert( | 340 globals->forced_spdy_exclusions.insert( |
341 net::HostPortPair::FromURL(GURL(value.as_string()))); | 341 net::HostPortPair::FromURL(GURL(value.as_string()))); |
342 continue; | 342 continue; |
343 } | 343 } |
344 if (option == kDisableCompression) { | 344 if (option == kDisableCompression) { |
345 globals->enable_spdy_compression.set(false); | 345 globals->enable_spdy_compression.set(false); |
346 continue; | 346 continue; |
347 } | 347 } |
348 if (option == kDisableAltProtocols) { | 348 if (option == kDisableAltProtocols) { |
349 globals->use_alternate_protocols.set(false); | 349 globals->use_alternative_services.set(false); |
350 continue; | 350 continue; |
351 } | 351 } |
352 if (option == kInitialMaxConcurrentStreams) { | 352 if (option == kInitialMaxConcurrentStreams) { |
353 int streams; | 353 int streams; |
354 if (base::StringToInt(value, &streams)) { | 354 if (base::StringToInt(value, &streams)) { |
355 globals->initial_max_spdy_concurrent_streams.set(streams); | 355 globals->initial_max_spdy_concurrent_streams.set(streams); |
356 continue; | 356 continue; |
357 } | 357 } |
358 } | 358 } |
359 LOG(DFATAL) << "Unrecognized spdy option: " << option.as_string(); | 359 LOG(DFATAL) << "Unrecognized spdy option: " << option.as_string(); |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 globals->next_protos.push_back(net::kProtoQUIC1SPDY3); | 998 globals->next_protos.push_back(net::kProtoQUIC1SPDY3); |
999 } | 999 } |
1000 | 1000 |
1001 // No SPDY command-line flags have been specified. Examine trial groups. | 1001 // No SPDY command-line flags have been specified. Examine trial groups. |
1002 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) { | 1002 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) { |
1003 net::HttpStreamFactory::set_spdy_enabled(false); | 1003 net::HttpStreamFactory::set_spdy_enabled(false); |
1004 return; | 1004 return; |
1005 } | 1005 } |
1006 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy31GroupNamePrefix)) { | 1006 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy31GroupNamePrefix)) { |
1007 globals->next_protos.push_back(net::kProtoSPDY31); | 1007 globals->next_protos.push_back(net::kProtoSPDY31); |
1008 globals->use_alternate_protocols.set(true); | 1008 globals->use_alternative_services.set(true); |
1009 return; | 1009 return; |
1010 } | 1010 } |
1011 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { | 1011 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { |
1012 globals->next_protos.push_back(net::kProtoSPDY31); | 1012 globals->next_protos.push_back(net::kProtoSPDY31); |
1013 globals->next_protos.push_back(net::kProtoHTTP2_14); | 1013 globals->next_protos.push_back(net::kProtoHTTP2_14); |
1014 globals->next_protos.push_back(net::kProtoHTTP2); | 1014 globals->next_protos.push_back(net::kProtoHTTP2); |
1015 globals->use_alternate_protocols.set(true); | 1015 globals->use_alternative_services.set(true); |
1016 return; | 1016 return; |
1017 } | 1017 } |
1018 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { | 1018 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { |
1019 bool spdy_enabled = false; | 1019 bool spdy_enabled = false; |
1020 if (base::LowerCaseEqualsASCII( | 1020 if (base::LowerCaseEqualsASCII( |
1021 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { | 1021 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { |
1022 globals->next_protos.push_back(net::kProtoSPDY31); | 1022 globals->next_protos.push_back(net::kProtoSPDY31); |
1023 spdy_enabled = true; | 1023 spdy_enabled = true; |
1024 } | 1024 } |
1025 if (base::LowerCaseEqualsASCII( | 1025 if (base::LowerCaseEqualsASCII( |
1026 GetVariationParam(spdy_trial_params, "enable_http2_14"), "true")) { | 1026 GetVariationParam(spdy_trial_params, "enable_http2_14"), "true")) { |
1027 globals->next_protos.push_back(net::kProtoHTTP2_14); | 1027 globals->next_protos.push_back(net::kProtoHTTP2_14); |
1028 spdy_enabled = true; | 1028 spdy_enabled = true; |
1029 } | 1029 } |
1030 if (base::LowerCaseEqualsASCII( | 1030 if (base::LowerCaseEqualsASCII( |
1031 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { | 1031 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { |
1032 globals->next_protos.push_back(net::kProtoHTTP2); | 1032 globals->next_protos.push_back(net::kProtoHTTP2); |
1033 spdy_enabled = true; | 1033 spdy_enabled = true; |
1034 } | 1034 } |
1035 // TODO(bnc): HttpStreamFactory::spdy_enabled_ is redundant with | 1035 // TODO(bnc): HttpStreamFactory::spdy_enabled_ is redundant with |
1036 // globals->next_protos, can it be eliminated? | 1036 // globals->next_protos, can it be eliminated? |
1037 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); | 1037 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); |
1038 globals->use_alternate_protocols.set(true); | 1038 globals->use_alternative_services.set(true); |
1039 return; | 1039 return; |
1040 } | 1040 } |
1041 | 1041 |
1042 // By default, enable HTTP/2. | 1042 // By default, enable HTTP/2. |
1043 globals->next_protos.push_back(net::kProtoSPDY31); | 1043 globals->next_protos.push_back(net::kProtoSPDY31); |
1044 globals->next_protos.push_back(net::kProtoHTTP2_14); | 1044 globals->next_protos.push_back(net::kProtoHTTP2_14); |
1045 globals->next_protos.push_back(net::kProtoHTTP2); | 1045 globals->next_protos.push_back(net::kProtoHTTP2); |
1046 globals->use_alternate_protocols.set(true); | 1046 globals->use_alternative_services.set(true); |
1047 } | 1047 } |
1048 | 1048 |
1049 // static | 1049 // static |
1050 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { | 1050 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { |
1051 registry->RegisterStringPref(prefs::kAuthSchemes, | 1051 registry->RegisterStringPref(prefs::kAuthSchemes, |
1052 "basic,digest,ntlm,negotiate"); | 1052 "basic,digest,ntlm,negotiate"); |
1053 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); | 1053 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); |
1054 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); | 1054 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); |
1055 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); | 1055 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); |
1056 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, | 1056 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 ¶ms->spdy_initial_max_concurrent_streams); | 1130 ¶ms->spdy_initial_max_concurrent_streams); |
1131 globals.enable_spdy_compression.CopyToIfSet( | 1131 globals.enable_spdy_compression.CopyToIfSet( |
1132 ¶ms->enable_spdy_compression); | 1132 ¶ms->enable_spdy_compression); |
1133 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( | 1133 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( |
1134 ¶ms->enable_spdy_ping_based_connection_checking); | 1134 ¶ms->enable_spdy_ping_based_connection_checking); |
1135 globals.spdy_default_protocol.CopyToIfSet( | 1135 globals.spdy_default_protocol.CopyToIfSet( |
1136 ¶ms->spdy_default_protocol); | 1136 ¶ms->spdy_default_protocol); |
1137 params->next_protos = globals.next_protos; | 1137 params->next_protos = globals.next_protos; |
1138 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); | 1138 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
1139 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1139 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
1140 globals.use_alternate_protocols.CopyToIfSet( | 1140 globals.use_alternative_services.CopyToIfSet( |
1141 ¶ms->use_alternate_protocols); | 1141 ¶ms->use_alternative_services); |
1142 globals.alternative_service_probability_threshold.CopyToIfSet( | 1142 globals.alternative_service_probability_threshold.CopyToIfSet( |
1143 ¶ms->alternative_service_probability_threshold); | 1143 ¶ms->alternative_service_probability_threshold); |
1144 | 1144 |
1145 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1145 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
1146 globals.enable_insecure_quic.CopyToIfSet(¶ms->enable_insecure_quic); | 1146 globals.enable_insecure_quic.CopyToIfSet(¶ms->enable_insecure_quic); |
1147 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1147 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
1148 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1148 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
1149 ¶ms->quic_always_require_handshake_confirmation); | 1149 ¶ms->quic_always_require_handshake_confirmation); |
1150 globals.quic_disable_connection_pooling.CopyToIfSet( | 1150 globals.quic_disable_connection_pooling.CopyToIfSet( |
1151 ¶ms->quic_disable_connection_pooling); | 1151 ¶ms->quic_disable_connection_pooling); |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1602 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
1603 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1603 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1604 net::QuicVersion version = supported_versions[i]; | 1604 net::QuicVersion version = supported_versions[i]; |
1605 if (net::QuicVersionToString(version) == quic_version) { | 1605 if (net::QuicVersionToString(version) == quic_version) { |
1606 return version; | 1606 return version; |
1607 } | 1607 } |
1608 } | 1608 } |
1609 | 1609 |
1610 return net::QUIC_VERSION_UNSUPPORTED; | 1610 return net::QUIC_VERSION_UNSUPPORTED; |
1611 } | 1611 } |
OLD | NEW |