| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 if (option == kExclude) { | 337 if (option == kExclude) { |
| 338 globals->forced_spdy_exclusions.insert( | 338 globals->forced_spdy_exclusions.insert( |
| 339 net::HostPortPair::FromURL(GURL(value.as_string()))); | 339 net::HostPortPair::FromURL(GURL(value.as_string()))); |
| 340 continue; | 340 continue; |
| 341 } | 341 } |
| 342 if (option == kDisableCompression) { | 342 if (option == kDisableCompression) { |
| 343 globals->enable_spdy_compression.set(false); | 343 globals->enable_spdy_compression.set(false); |
| 344 continue; | 344 continue; |
| 345 } | 345 } |
| 346 if (option == kDisableAltProtocols) { | 346 if (option == kDisableAltProtocols) { |
| 347 globals->use_alternate_protocols.set(false); | 347 globals->use_alternative_services.set(false); |
| 348 continue; | 348 continue; |
| 349 } | 349 } |
| 350 if (option == kInitialMaxConcurrentStreams) { | 350 if (option == kInitialMaxConcurrentStreams) { |
| 351 int streams; | 351 int streams; |
| 352 if (base::StringToInt(value, &streams)) { | 352 if (base::StringToInt(value, &streams)) { |
| 353 globals->initial_max_spdy_concurrent_streams.set(streams); | 353 globals->initial_max_spdy_concurrent_streams.set(streams); |
| 354 continue; | 354 continue; |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 LOG(DFATAL) << "Unrecognized spdy option: " << option.as_string(); | 357 LOG(DFATAL) << "Unrecognized spdy option: " << option.as_string(); |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 globals->next_protos.push_back(net::kProtoQUIC1SPDY3); | 989 globals->next_protos.push_back(net::kProtoQUIC1SPDY3); |
| 990 } | 990 } |
| 991 | 991 |
| 992 // No SPDY command-line flags have been specified. Examine trial groups. | 992 // No SPDY command-line flags have been specified. Examine trial groups. |
| 993 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) { | 993 if (spdy_trial_group.starts_with(kSpdyFieldTrialHoldbackGroupNamePrefix)) { |
| 994 net::HttpStreamFactory::set_spdy_enabled(false); | 994 net::HttpStreamFactory::set_spdy_enabled(false); |
| 995 return; | 995 return; |
| 996 } | 996 } |
| 997 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy31GroupNamePrefix)) { | 997 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy31GroupNamePrefix)) { |
| 998 globals->next_protos.push_back(net::kProtoSPDY31); | 998 globals->next_protos.push_back(net::kProtoSPDY31); |
| 999 globals->use_alternate_protocols.set(true); | 999 globals->use_alternative_services.set(true); |
| 1000 return; | 1000 return; |
| 1001 } | 1001 } |
| 1002 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { | 1002 if (spdy_trial_group.starts_with(kSpdyFieldTrialSpdy4GroupNamePrefix)) { |
| 1003 globals->next_protos.push_back(net::kProtoSPDY31); | 1003 globals->next_protos.push_back(net::kProtoSPDY31); |
| 1004 globals->next_protos.push_back(net::kProtoHTTP2_14); | 1004 globals->next_protos.push_back(net::kProtoHTTP2_14); |
| 1005 globals->next_protos.push_back(net::kProtoHTTP2); | 1005 globals->next_protos.push_back(net::kProtoHTTP2); |
| 1006 globals->use_alternate_protocols.set(true); | 1006 globals->use_alternative_services.set(true); |
| 1007 return; | 1007 return; |
| 1008 } | 1008 } |
| 1009 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { | 1009 if (spdy_trial_group.starts_with(kSpdyFieldTrialParametrizedPrefix)) { |
| 1010 bool spdy_enabled = false; | 1010 bool spdy_enabled = false; |
| 1011 if (base::LowerCaseEqualsASCII( | 1011 if (base::LowerCaseEqualsASCII( |
| 1012 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { | 1012 GetVariationParam(spdy_trial_params, "enable_spdy31"), "true")) { |
| 1013 globals->next_protos.push_back(net::kProtoSPDY31); | 1013 globals->next_protos.push_back(net::kProtoSPDY31); |
| 1014 spdy_enabled = true; | 1014 spdy_enabled = true; |
| 1015 } | 1015 } |
| 1016 if (base::LowerCaseEqualsASCII( | 1016 if (base::LowerCaseEqualsASCII( |
| 1017 GetVariationParam(spdy_trial_params, "enable_http2_14"), "true")) { | 1017 GetVariationParam(spdy_trial_params, "enable_http2_14"), "true")) { |
| 1018 globals->next_protos.push_back(net::kProtoHTTP2_14); | 1018 globals->next_protos.push_back(net::kProtoHTTP2_14); |
| 1019 spdy_enabled = true; | 1019 spdy_enabled = true; |
| 1020 } | 1020 } |
| 1021 if (base::LowerCaseEqualsASCII( | 1021 if (base::LowerCaseEqualsASCII( |
| 1022 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { | 1022 GetVariationParam(spdy_trial_params, "enable_http2"), "true")) { |
| 1023 globals->next_protos.push_back(net::kProtoHTTP2); | 1023 globals->next_protos.push_back(net::kProtoHTTP2); |
| 1024 spdy_enabled = true; | 1024 spdy_enabled = true; |
| 1025 } | 1025 } |
| 1026 // TODO(bnc): HttpStreamFactory::spdy_enabled_ is redundant with | 1026 // TODO(bnc): HttpStreamFactory::spdy_enabled_ is redundant with |
| 1027 // globals->next_protos, can it be eliminated? | 1027 // globals->next_protos, can it be eliminated? |
| 1028 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); | 1028 net::HttpStreamFactory::set_spdy_enabled(spdy_enabled); |
| 1029 globals->use_alternate_protocols.set(true); | 1029 globals->use_alternative_services.set(true); |
| 1030 return; | 1030 return; |
| 1031 } | 1031 } |
| 1032 | 1032 |
| 1033 // By default, enable HTTP/2. | 1033 // By default, enable HTTP/2. |
| 1034 globals->next_protos.push_back(net::kProtoSPDY31); | 1034 globals->next_protos.push_back(net::kProtoSPDY31); |
| 1035 globals->next_protos.push_back(net::kProtoHTTP2_14); | 1035 globals->next_protos.push_back(net::kProtoHTTP2_14); |
| 1036 globals->next_protos.push_back(net::kProtoHTTP2); | 1036 globals->next_protos.push_back(net::kProtoHTTP2); |
| 1037 globals->use_alternate_protocols.set(true); | 1037 globals->use_alternative_services.set(true); |
| 1038 } | 1038 } |
| 1039 | 1039 |
| 1040 // static | 1040 // static |
| 1041 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { | 1041 void IOThread::RegisterPrefs(PrefRegistrySimple* registry) { |
| 1042 registry->RegisterStringPref(prefs::kAuthSchemes, | 1042 registry->RegisterStringPref(prefs::kAuthSchemes, |
| 1043 "basic,digest,ntlm,negotiate"); | 1043 "basic,digest,ntlm,negotiate"); |
| 1044 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); | 1044 registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false); |
| 1045 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); | 1045 registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false); |
| 1046 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); | 1046 registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string()); |
| 1047 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, | 1047 registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 ¶ms->spdy_initial_max_concurrent_streams); | 1121 ¶ms->spdy_initial_max_concurrent_streams); |
| 1122 globals.enable_spdy_compression.CopyToIfSet( | 1122 globals.enable_spdy_compression.CopyToIfSet( |
| 1123 ¶ms->enable_spdy_compression); | 1123 ¶ms->enable_spdy_compression); |
| 1124 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( | 1124 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( |
| 1125 ¶ms->enable_spdy_ping_based_connection_checking); | 1125 ¶ms->enable_spdy_ping_based_connection_checking); |
| 1126 globals.spdy_default_protocol.CopyToIfSet( | 1126 globals.spdy_default_protocol.CopyToIfSet( |
| 1127 ¶ms->spdy_default_protocol); | 1127 ¶ms->spdy_default_protocol); |
| 1128 params->next_protos = globals.next_protos; | 1128 params->next_protos = globals.next_protos; |
| 1129 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); | 1129 globals.trusted_spdy_proxy.CopyToIfSet(¶ms->trusted_spdy_proxy); |
| 1130 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; | 1130 params->forced_spdy_exclusions = globals.forced_spdy_exclusions; |
| 1131 globals.use_alternate_protocols.CopyToIfSet( | 1131 globals.use_alternative_services.CopyToIfSet( |
| 1132 ¶ms->use_alternate_protocols); | 1132 ¶ms->use_alternative_services); |
| 1133 globals.alternative_service_probability_threshold.CopyToIfSet( | 1133 globals.alternative_service_probability_threshold.CopyToIfSet( |
| 1134 ¶ms->alternative_service_probability_threshold); | 1134 ¶ms->alternative_service_probability_threshold); |
| 1135 | 1135 |
| 1136 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); | 1136 globals.enable_quic.CopyToIfSet(¶ms->enable_quic); |
| 1137 globals.enable_insecure_quic.CopyToIfSet(¶ms->enable_insecure_quic); | 1137 globals.enable_insecure_quic.CopyToIfSet(¶ms->enable_insecure_quic); |
| 1138 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); | 1138 globals.enable_quic_for_proxies.CopyToIfSet(¶ms->enable_quic_for_proxies); |
| 1139 globals.quic_always_require_handshake_confirmation.CopyToIfSet( | 1139 globals.quic_always_require_handshake_confirmation.CopyToIfSet( |
| 1140 ¶ms->quic_always_require_handshake_confirmation); | 1140 ¶ms->quic_always_require_handshake_confirmation); |
| 1141 globals.quic_disable_connection_pooling.CopyToIfSet( | 1141 globals.quic_disable_connection_pooling.CopyToIfSet( |
| 1142 ¶ms->quic_disable_connection_pooling); | 1142 ¶ms->quic_disable_connection_pooling); |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1593 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1594 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1594 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1595 net::QuicVersion version = supported_versions[i]; | 1595 net::QuicVersion version = supported_versions[i]; |
| 1596 if (net::QuicVersionToString(version) == quic_version) { | 1596 if (net::QuicVersionToString(version) == quic_version) { |
| 1597 return version; | 1597 return version; |
| 1598 } | 1598 } |
| 1599 } | 1599 } |
| 1600 | 1600 |
| 1601 return net::QUIC_VERSION_UNSUPPORTED; | 1601 return net::QUIC_VERSION_UNSUPPORTED; |
| 1602 } | 1602 } |
| OLD | NEW |