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 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/net/chrome_network_delegate.h" | 34 #include "chrome/browser/net/chrome_network_delegate.h" |
35 #include "chrome/browser/net/chrome_url_request_context.h" | 35 #include "chrome/browser/net/chrome_url_request_context.h" |
36 #include "chrome/browser/net/connect_interceptor.h" | 36 #include "chrome/browser/net/connect_interceptor.h" |
37 #include "chrome/browser/net/dns_probe_service.h" | 37 #include "chrome/browser/net/dns_probe_service.h" |
38 #include "chrome/browser/net/http_pipelining_compatibility_client.h" | 38 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
39 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 39 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
40 #include "chrome/browser/net/proxy_service_factory.h" | 40 #include "chrome/browser/net/proxy_service_factory.h" |
41 #include "chrome/browser/net/sdch_dictionary_fetcher.h" | 41 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
42 #include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h" | 42 #include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h" |
43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
| 44 #include "chrome/common/chrome_version_info.h" |
44 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
45 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
46 #include "components/policy/core/common/policy_service.h" | 47 #include "components/policy/core/common/policy_service.h" |
47 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
48 #include "content/public/browser/cookie_store_factory.h" | 49 #include "content/public/browser/cookie_store_factory.h" |
49 #include "net/base/host_mapping_rules.h" | 50 #include "net/base/host_mapping_rules.h" |
50 #include "net/base/net_util.h" | 51 #include "net/base/net_util.h" |
51 #include "net/base/network_time_notifier.h" | 52 #include "net/base/network_time_notifier.h" |
52 #include "net/base/sdch_manager.h" | 53 #include "net/base/sdch_manager.h" |
53 #include "net/cert/cert_verifier.h" | 54 #include "net/cert/cert_verifier.h" |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 globals_->enable_spdy_compression.CopyToIfSet( | 969 globals_->enable_spdy_compression.CopyToIfSet( |
969 ¶ms->enable_spdy_compression); | 970 ¶ms->enable_spdy_compression); |
970 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( | 971 globals_->enable_spdy_ping_based_connection_checking.CopyToIfSet( |
971 ¶ms->enable_spdy_ping_based_connection_checking); | 972 ¶ms->enable_spdy_ping_based_connection_checking); |
972 globals_->spdy_default_protocol.CopyToIfSet( | 973 globals_->spdy_default_protocol.CopyToIfSet( |
973 ¶ms->spdy_default_protocol); | 974 ¶ms->spdy_default_protocol); |
974 globals_->trusted_spdy_proxy.CopyToIfSet( | 975 globals_->trusted_spdy_proxy.CopyToIfSet( |
975 ¶ms->trusted_spdy_proxy); | 976 ¶ms->trusted_spdy_proxy); |
976 globals_->enable_quic.CopyToIfSet(¶ms->enable_quic); | 977 globals_->enable_quic.CopyToIfSet(¶ms->enable_quic); |
977 globals_->enable_quic_https.CopyToIfSet(¶ms->enable_quic_https); | 978 globals_->enable_quic_https.CopyToIfSet(¶ms->enable_quic_https); |
| 979 globals_->enable_quic_port_selection.CopyToIfSet( |
| 980 ¶ms->enable_quic_port_selection); |
978 globals_->quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); | 981 globals_->quic_max_packet_length.CopyToIfSet(¶ms->quic_max_packet_length); |
979 globals_->quic_supported_versions.CopyToIfSet( | 982 globals_->quic_supported_versions.CopyToIfSet( |
980 ¶ms->quic_supported_versions); | 983 ¶ms->quic_supported_versions); |
981 globals_->origin_to_force_quic_on.CopyToIfSet( | 984 globals_->origin_to_force_quic_on.CopyToIfSet( |
982 ¶ms->origin_to_force_quic_on); | 985 ¶ms->origin_to_force_quic_on); |
983 params->enable_user_alternate_protocol_ports = | 986 params->enable_user_alternate_protocol_ports = |
984 globals_->enable_user_alternate_protocol_ports; | 987 globals_->enable_user_alternate_protocol_ports; |
985 } | 988 } |
986 | 989 |
987 net::SSLConfigService* IOThread::GetSSLConfigService() { | 990 net::SSLConfigService* IOThread::GetSSLConfigService() { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 // The command line flags will be associated with a group that is reported | 1058 // The command line flags will be associated with a group that is reported |
1056 // so long as trial is actually queried. | 1059 // so long as trial is actually queried. |
1057 std::string quic_trial_group = | 1060 std::string quic_trial_group = |
1058 base::FieldTrialList::FindFullName(kQuicFieldTrialName); | 1061 base::FieldTrialList::FindFullName(kQuicFieldTrialName); |
1059 | 1062 |
1060 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); | 1063 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); |
1061 globals_->enable_quic.set(enable_quic); | 1064 globals_->enable_quic.set(enable_quic); |
1062 if (enable_quic) { | 1065 if (enable_quic) { |
1063 globals_->enable_quic_https.set( | 1066 globals_->enable_quic_https.set( |
1064 ShouldEnableQuicHttps(command_line, quic_trial_group)); | 1067 ShouldEnableQuicHttps(command_line, quic_trial_group)); |
| 1068 globals_->enable_quic_port_selection.set( |
| 1069 ShouldEnableEnableQuicPortSelection(command_line)); |
1065 } | 1070 } |
1066 | 1071 |
1067 size_t max_packet_length = GetQuicMaxPacketLength(command_line, | 1072 size_t max_packet_length = GetQuicMaxPacketLength(command_line, |
1068 quic_trial_group); | 1073 quic_trial_group); |
1069 if (max_packet_length != 0) { | 1074 if (max_packet_length != 0) { |
1070 globals_->quic_max_packet_length.set(max_packet_length); | 1075 globals_->quic_max_packet_length.set(max_packet_length); |
1071 } | 1076 } |
1072 | 1077 |
1073 net::QuicVersion version = GetQuicVersion(command_line); | 1078 net::QuicVersion version = GetQuicVersion(command_line); |
1074 if (version != net::QUIC_VERSION_UNSUPPORTED) { | 1079 if (version != net::QUIC_VERSION_UNSUPPORTED) { |
(...skipping 28 matching lines...) Expand all Loading... |
1103 base::StringPiece quic_trial_group) { | 1108 base::StringPiece quic_trial_group) { |
1104 if (command_line.HasSwitch(switches::kDisableQuicHttps)) | 1109 if (command_line.HasSwitch(switches::kDisableQuicHttps)) |
1105 return false; | 1110 return false; |
1106 | 1111 |
1107 if (command_line.HasSwitch(switches::kEnableQuicHttps)) | 1112 if (command_line.HasSwitch(switches::kEnableQuicHttps)) |
1108 return true; | 1113 return true; |
1109 | 1114 |
1110 return quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); | 1115 return quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); |
1111 } | 1116 } |
1112 | 1117 |
| 1118 bool IOThread::ShouldEnableEnableQuicPortSelection( |
| 1119 const CommandLine& command_line) { |
| 1120 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) |
| 1121 return false; |
| 1122 |
| 1123 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
| 1124 return true; |
| 1125 |
| 1126 #if defined(OS_WIN) |
| 1127 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 1128 // Avoid picking ports (which might induce a security dialog) when we have a |
| 1129 // beta or stable release. Allow in all other cases, including when we do a |
| 1130 // developer build (CHANNEL_UNKNOWN). |
| 1131 if (channel == chrome::VersionInfo::CHANNEL_STABLE || |
| 1132 channel == chrome::VersionInfo::CHANNEL_BETA) { |
| 1133 // TODO(jar): When we have an API to see if the administrative security |
| 1134 // manager will allow port selection without a security dialog, we may |
| 1135 // return true if we're sure there will be no security dialog. |
| 1136 return false; |
| 1137 } |
| 1138 return true; |
| 1139 #else |
| 1140 return true; |
| 1141 #endif |
| 1142 } |
| 1143 |
1113 size_t IOThread::GetQuicMaxPacketLength(const CommandLine& command_line, | 1144 size_t IOThread::GetQuicMaxPacketLength(const CommandLine& command_line, |
1114 base::StringPiece quic_trial_group) { | 1145 base::StringPiece quic_trial_group) { |
1115 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1146 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
1116 unsigned value; | 1147 unsigned value; |
1117 if (!base::StringToUint( | 1148 if (!base::StringToUint( |
1118 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), | 1149 command_line.GetSwitchValueASCII(switches::kQuicMaxPacketLength), |
1119 &value)) { | 1150 &value)) { |
1120 return 0; | 1151 return 0; |
1121 } | 1152 } |
1122 return value; | 1153 return value; |
(...skipping 28 matching lines...) Expand all Loading... |
1151 std::string version_flag = | 1182 std::string version_flag = |
1152 command_line.GetSwitchValueASCII(switches::kQuicVersion); | 1183 command_line.GetSwitchValueASCII(switches::kQuicVersion); |
1153 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1184 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1154 net::QuicVersion version = supported_versions[i]; | 1185 net::QuicVersion version = supported_versions[i]; |
1155 if (net::QuicVersionToString(version) == version_flag) { | 1186 if (net::QuicVersionToString(version) == version_flag) { |
1156 return version; | 1187 return version; |
1157 } | 1188 } |
1158 } | 1189 } |
1159 return net::QUIC_VERSION_UNSUPPORTED; | 1190 return net::QUIC_VERSION_UNSUPPORTED; |
1160 } | 1191 } |
OLD | NEW |