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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/debug/leak_tracker.h" | 14 #include "base/debug/leak_tracker.h" |
15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
| 18 #include "base/path_service.h" |
18 #include "base/prefs/pref_registry_simple.h" | 19 #include "base/prefs/pref_registry_simple.h" |
19 #include "base/prefs/pref_service.h" | 20 #include "base/prefs/pref_service.h" |
20 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
23 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
24 #include "base/threading/sequenced_worker_pool.h" | 25 #include "base/threading/sequenced_worker_pool.h" |
25 #include "base/threading/thread.h" | 26 #include "base/threading/thread.h" |
26 #include "base/threading/worker_pool.h" | 27 #include "base/threading/worker_pool.h" |
27 #include "base/time/default_tick_clock.h" | 28 #include "base/time/default_tick_clock.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 #include "net/ssl/server_bound_cert_service.h" | 76 #include "net/ssl/server_bound_cert_service.h" |
76 #include "net/url_request/data_protocol_handler.h" | 77 #include "net/url_request/data_protocol_handler.h" |
77 #include "net/url_request/file_protocol_handler.h" | 78 #include "net/url_request/file_protocol_handler.h" |
78 #include "net/url_request/ftp_protocol_handler.h" | 79 #include "net/url_request/ftp_protocol_handler.h" |
79 #include "net/url_request/url_fetcher.h" | 80 #include "net/url_request/url_fetcher.h" |
80 #include "net/url_request/url_request_job_factory_impl.h" | 81 #include "net/url_request/url_request_job_factory_impl.h" |
81 #include "net/url_request/url_request_throttler_manager.h" | 82 #include "net/url_request/url_request_throttler_manager.h" |
82 #include "net/websockets/websocket_job.h" | 83 #include "net/websockets/websocket_job.h" |
83 | 84 |
84 #if defined(OS_WIN) | 85 #if defined(OS_WIN) |
| 86 #include "chrome/installer/util/browser_distribution.h" |
| 87 #include "chrome/installer/util/firewall_manager.h" |
85 #include "win8/util/win8_util.h" | 88 #include "win8/util/win8_util.h" |
86 #endif | 89 #endif |
87 | 90 |
88 #if defined(ENABLE_CONFIGURATION_POLICY) | 91 #if defined(ENABLE_CONFIGURATION_POLICY) |
89 #include "policy/policy_constants.h" | 92 #include "policy/policy_constants.h" |
90 #endif | 93 #endif |
91 | 94 |
92 #if !defined(USE_OPENSSL) | 95 #if !defined(USE_OPENSSL) |
93 #include "net/cert/ct_log_verifier.h" | 96 #include "net/cert/ct_log_verifier.h" |
94 #include "net/cert/multi_log_ct_verifier.h" | 97 #include "net/cert/multi_log_ct_verifier.h" |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 bool IOThread::ShouldEnableQuicPortSelection( | 1141 bool IOThread::ShouldEnableQuicPortSelection( |
1139 const CommandLine& command_line) { | 1142 const CommandLine& command_line) { |
1140 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) | 1143 if (command_line.HasSwitch(switches::kDisableQuicPortSelection)) |
1141 return false; | 1144 return false; |
1142 | 1145 |
1143 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) | 1146 if (command_line.HasSwitch(switches::kEnableQuicPortSelection)) |
1144 return true; | 1147 return true; |
1145 | 1148 |
1146 #if defined(OS_WIN) | 1149 #if defined(OS_WIN) |
1147 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 1150 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
1148 // Avoid picking ports (which might induce a security dialog) when we have a | 1151 // Only pick ports on beta and stable channels when it seems that the firewall |
1149 // beta or stable release. Allow in all other cases, including when we do a | 1152 // will allow it without prompting the user. |
1150 // developer build (CHANNEL_UNKNOWN). | |
1151 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | 1153 if (channel == chrome::VersionInfo::CHANNEL_STABLE || |
1152 channel == chrome::VersionInfo::CHANNEL_BETA) { | 1154 channel == chrome::VersionInfo::CHANNEL_BETA) { |
1153 // TODO(grt) bug=329255: Detect presence of rule on Windows that allows us | 1155 base::FilePath chrome_exe; |
1154 // to do port selection without inducing a dialog. | 1156 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) |
1155 // When we have an API to see if the administrative security manager will | 1157 return false; |
1156 // allow port selection without a security dialog, we may return true if | 1158 scoped_ptr<installer::FirewallManager> firewall_manager( |
1157 // we're sure there will be no security dialog. | 1159 installer::FirewallManager::Create( |
1158 return false; | 1160 BrowserDistribution::GetDistribution(), chrome_exe)); |
| 1161 return firewall_manager && firewall_manager->CanUseLocalUDPPort(); |
1159 } | 1162 } |
1160 return true; | 1163 return true; |
1161 #else | 1164 #else |
1162 return true; | 1165 return true; |
1163 #endif | 1166 #endif |
1164 } | 1167 } |
1165 | 1168 |
1166 size_t IOThread::GetQuicMaxPacketLength(const CommandLine& command_line, | 1169 size_t IOThread::GetQuicMaxPacketLength(const CommandLine& command_line, |
1167 base::StringPiece quic_trial_group) { | 1170 base::StringPiece quic_trial_group) { |
1168 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { | 1171 if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 std::string version_flag = | 1207 std::string version_flag = |
1205 command_line.GetSwitchValueASCII(switches::kQuicVersion); | 1208 command_line.GetSwitchValueASCII(switches::kQuicVersion); |
1206 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1209 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1207 net::QuicVersion version = supported_versions[i]; | 1210 net::QuicVersion version = supported_versions[i]; |
1208 if (net::QuicVersionToString(version) == version_flag) { | 1211 if (net::QuicVersionToString(version) == version_flag) { |
1209 return version; | 1212 return version; |
1210 } | 1213 } |
1211 } | 1214 } |
1212 return net::QUIC_VERSION_UNSUPPORTED; | 1215 return net::QUIC_VERSION_UNSUPPORTED; |
1213 } | 1216 } |
OLD | NEW |