Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1540)

Unified Diff: chrome/browser/io_thread.cc

Issue 127463003: Completely disable use of bind() with pseudo-random port selection on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: On Windows, avoid "port selection" in Stable or Beta channels automatically Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index af4638314d5caf594a42e38d32c6d9f553983766..ab689470b53e3d8ec79d13827b00711ea92da933 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -41,6 +41,7 @@
#include "chrome/browser/net/sdch_dictionary_fetcher.h"
#include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/policy/core/common/policy_service.h"
@@ -975,6 +976,8 @@ void IOThread::InitializeNetworkSessionParams(
&params->trusted_spdy_proxy);
globals_->enable_quic.CopyToIfSet(&params->enable_quic);
globals_->enable_quic_https.CopyToIfSet(&params->enable_quic_https);
+ globals_->enable_quic_port_selection.CopyToIfSet(
+ &params->enable_quic_port_selection);
globals_->quic_max_packet_length.CopyToIfSet(&params->quic_max_packet_length);
globals_->quic_supported_versions.CopyToIfSet(
&params->quic_supported_versions);
@@ -1062,6 +1065,8 @@ void IOThread::ConfigureQuic(const CommandLine& command_line) {
if (enable_quic) {
globals_->enable_quic_https.set(
ShouldEnableQuicHttps(command_line, quic_trial_group));
+ globals_->enable_quic_port_selection.set(
+ ShouldEnableEnableQuicPortSelection(command_line));
}
size_t max_packet_length = GetQuicMaxPacketLength(command_line,
@@ -1110,6 +1115,32 @@ bool IOThread::ShouldEnableQuicHttps(const CommandLine& command_line,
return quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName);
}
+bool IOThread::ShouldEnableEnableQuicPortSelection(
+ const CommandLine& command_line) {
+ if (command_line.HasSwitch(switches::kDisableQuicPortSelection))
+ return false;
+
+ if (command_line.HasSwitch(switches::kEnableQuicPortSelection))
+ return true;
+
+#if defined(OS_WIN)
+ chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
+ // Avoid picking ports (which might induce a security dialog) when we have a
+ // beta or stable release. Allow in all other cases, including when we do a
+ // developer build (CHANNEL_UNKNOWN).
+ if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
+ channel == chrome::VersionInfo::CHANNEL_BETA) {
+ // TODO(jar): When we have an API to see if the administrative security
+ // manager will allow port selection without a security dialog, we may
+ // return true if we're sure there will be no security dialog.
+ return false;
+ }
+ return true;
+#else
+ return true;
+#endif
+}
+
size_t IOThread::GetQuicMaxPacketLength(const CommandLine& command_line,
base::StringPiece quic_trial_group) {
if (command_line.HasSwitch(switches::kQuicMaxPacketLength)) {
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698