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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 998383002: Created policy QuicAllowed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 PrefService* local_state, 450 PrefService* local_state,
451 policy::PolicyService* policy_service, 451 policy::PolicyService* policy_service,
452 ChromeNetLog* net_log, 452 ChromeNetLog* net_log,
453 extensions::EventRouterForwarder* extension_event_router_forwarder) 453 extensions::EventRouterForwarder* extension_event_router_forwarder)
454 : net_log_(net_log), 454 : net_log_(net_log),
455 #if defined(ENABLE_EXTENSIONS) 455 #if defined(ENABLE_EXTENSIONS)
456 extension_event_router_forwarder_(extension_event_router_forwarder), 456 extension_event_router_forwarder_(extension_event_router_forwarder),
457 #endif 457 #endif
458 globals_(NULL), 458 globals_(NULL),
459 is_spdy_disabled_by_policy_(false), 459 is_spdy_disabled_by_policy_(false),
460 is_quic_allowed_by_policy_(true),
460 creation_time_(base::TimeTicks::Now()), 461 creation_time_(base::TimeTicks::Now()),
461 weak_factory_(this) { 462 weak_factory_(this) {
462 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); 463 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes);
463 negotiate_disable_cname_lookup_ = local_state->GetBoolean( 464 negotiate_disable_cname_lookup_ = local_state->GetBoolean(
464 prefs::kDisableAuthNegotiateCnameLookup); 465 prefs::kDisableAuthNegotiateCnameLookup);
465 negotiate_enable_port_ = local_state->GetBoolean( 466 negotiate_enable_port_ = local_state->GetBoolean(
466 prefs::kEnableAuthNegotiatePort); 467 prefs::kEnableAuthNegotiatePort);
467 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist); 468 auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist);
468 auth_delegate_whitelist_ = local_state->GetString( 469 auth_delegate_whitelist_ = local_state->GetString(
469 prefs::kAuthNegotiateDelegateWhitelist); 470 prefs::kAuthNegotiateDelegateWhitelist);
(...skipping 27 matching lines...) Expand all
497 498
498 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, 499 quick_check_enabled_.Init(prefs::kQuickCheckEnabled,
499 local_state); 500 local_state);
500 quick_check_enabled_.MoveToThread( 501 quick_check_enabled_.MoveToThread(
501 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 502 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
502 503
503 #if defined(ENABLE_CONFIGURATION_POLICY) 504 #if defined(ENABLE_CONFIGURATION_POLICY)
504 is_spdy_disabled_by_policy_ = policy_service->GetPolicies( 505 is_spdy_disabled_by_policy_ = policy_service->GetPolicies(
505 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())).Get( 506 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())).Get(
506 policy::key::kDisableSpdy) != NULL; 507 policy::key::kDisableSpdy) != NULL;
508
509 const base::Value* value = policy_service->GetPolicies(
510 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME,
511 std::string())).GetValue(policy::key::kQuicAllowed);
512 if (value)
513 value->GetAsBoolean(&is_quic_allowed_by_policy_);
507 #endif // ENABLE_CONFIGURATION_POLICY 514 #endif // ENABLE_CONFIGURATION_POLICY
508 515
509 BrowserThread::SetDelegate(BrowserThread::IO, this); 516 BrowserThread::SetDelegate(BrowserThread::IO, this);
510 } 517 }
511 518
512 IOThread::~IOThread() { 519 IOThread::~IOThread() {
513 // This isn't needed for production code, but in tests, IOThread may 520 // This isn't needed for production code, but in tests, IOThread may
514 // be multiply constructed. 521 // be multiply constructed.
515 BrowserThread::SetDelegate(BrowserThread::IO, NULL); 522 BrowserThread::SetDelegate(BrowserThread::IO, NULL);
516 523
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 // Always fetch the field trial group to ensure it is reported correctly. 1230 // Always fetch the field trial group to ensure it is reported correctly.
1224 // The command line flags will be associated with a group that is reported 1231 // The command line flags will be associated with a group that is reported
1225 // so long as trial is actually queried. 1232 // so long as trial is actually queried.
1226 std::string group = 1233 std::string group =
1227 base::FieldTrialList::FindFullName(kQuicFieldTrialName); 1234 base::FieldTrialList::FindFullName(kQuicFieldTrialName);
1228 VariationParameters params; 1235 VariationParameters params;
1229 if (!variations::GetVariationParams(kQuicFieldTrialName, &params)) { 1236 if (!variations::GetVariationParams(kQuicFieldTrialName, &params)) {
1230 params.clear(); 1237 params.clear();
1231 } 1238 }
1232 1239
1233 ConfigureQuicGlobals(command_line, group, params, globals_); 1240 ConfigureQuicGlobals(command_line, group, params, is_quic_allowed_by_policy_,
1241 globals_);
Ryan Hamilton 2015/03/18 18:42:54 nit: this wrapping looks funny to me. I think the
peletskyi 2015/03/20 17:54:47 Done.
1234 } 1242 }
1235 1243
1236 // static 1244 // static
1237 void IOThread::ConfigureQuicGlobals( 1245 void IOThread::ConfigureQuicGlobals(
1238 const base::CommandLine& command_line, 1246 const base::CommandLine& command_line,
1239 base::StringPiece quic_trial_group, 1247 base::StringPiece quic_trial_group,
1240 const VariationParameters& quic_trial_params, 1248 const VariationParameters& quic_trial_params,
1249 bool quic_allowed_by_policy,
1241 IOThread::Globals* globals) { 1250 IOThread::Globals* globals) {
1242 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group); 1251 bool enable_quic = ShouldEnableQuic(command_line, quic_trial_group,
1252 quic_allowed_by_policy);
Ryan Hamilton 2015/03/18 18:42:54 ditto about wrapping.
peletskyi 2015/03/20 17:54:47 Done.
1243 globals->enable_quic.set(enable_quic); 1253 globals->enable_quic.set(enable_quic);
1244 bool enable_quic_for_proxies = ShouldEnableQuicForProxies(command_line, 1254 bool enable_quic_for_proxies = ShouldEnableQuicForProxies(command_line,
1245 quic_trial_group); 1255 quic_trial_group, quic_allowed_by_policy);
Ryan Hamilton 2015/03/18 18:42:54 ditto about wrapping.
peletskyi 2015/03/20 17:54:47 Done.
1246 globals->enable_quic_for_proxies.set(enable_quic_for_proxies); 1256 globals->enable_quic_for_proxies.set(enable_quic_for_proxies);
1247 if (enable_quic) { 1257 if (enable_quic) {
1248 globals->quic_always_require_handshake_confirmation.set( 1258 globals->quic_always_require_handshake_confirmation.set(
1249 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params)); 1259 ShouldQuicAlwaysRequireHandshakeConfirmation(quic_trial_params));
1250 globals->quic_disable_connection_pooling.set( 1260 globals->quic_disable_connection_pooling.set(
1251 ShouldQuicDisableConnectionPooling(quic_trial_params)); 1261 ShouldQuicDisableConnectionPooling(quic_trial_params));
1252 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params); 1262 int receive_buffer_size = GetQuicSocketReceiveBufferSize(quic_trial_params);
1253 if (receive_buffer_size != 0) { 1263 if (receive_buffer_size != 0) {
1254 globals->quic_socket_receive_buffer_size.set(receive_buffer_size); 1264 globals->quic_socket_receive_buffer_size.set(receive_buffer_size);
1255 } 1265 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 net::HostPortPair quic_origin = 1317 net::HostPortPair quic_origin =
1308 net::HostPortPair::FromString( 1318 net::HostPortPair::FromString(
1309 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn)); 1319 command_line.GetSwitchValueASCII(switches::kOriginToForceQuicOn));
1310 if (!quic_origin.IsEmpty()) { 1320 if (!quic_origin.IsEmpty()) {
1311 globals->origin_to_force_quic_on.set(quic_origin); 1321 globals->origin_to_force_quic_on.set(quic_origin);
1312 } 1322 }
1313 } 1323 }
1314 } 1324 }
1315 1325
1316 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line, 1326 bool IOThread::ShouldEnableQuic(const base::CommandLine& command_line,
1317 base::StringPiece quic_trial_group) { 1327 base::StringPiece quic_trial_group,
1318 if (command_line.HasSwitch(switches::kDisableQuic)) 1328 bool quic_allowed_by_policy) {
1329 if (command_line.HasSwitch(switches::kDisableQuic) || !quic_allowed_by_policy)
1319 return false; 1330 return false;
1320 1331
1321 if (command_line.HasSwitch(switches::kEnableQuic)) 1332 if (command_line.HasSwitch(switches::kEnableQuic))
1322 return true; 1333 return true;
1323 1334
1324 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) || 1335 return quic_trial_group.starts_with(kQuicFieldTrialEnabledGroupName) ||
1325 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName); 1336 quic_trial_group.starts_with(kQuicFieldTrialHttpsEnabledGroupName);
1326 } 1337 }
1327 1338
1328 // static 1339 // static
1329 bool IOThread::ShouldEnableQuicForProxies(const base::CommandLine& command_line, 1340 bool IOThread::ShouldEnableQuicForProxies(const base::CommandLine& command_line,
1330 base::StringPiece quic_trial_group) { 1341 base::StringPiece quic_trial_group,
1331 return ShouldEnableQuic(command_line, quic_trial_group) || 1342 bool quic_allowed_by_policy) {
1343 return ShouldEnableQuic(
1344 command_line, quic_trial_group, quic_allowed_by_policy) ||
1332 ShouldEnableQuicForDataReductionProxy(); 1345 ShouldEnableQuicForDataReductionProxy();
1333 } 1346 }
1334 1347
1335 // static 1348 // static
1336 bool IOThread::ShouldEnableQuicForDataReductionProxy() { 1349 bool IOThread::ShouldEnableQuicForDataReductionProxy() {
1337 const base::CommandLine& command_line = 1350 const base::CommandLine& command_line =
1338 *base::CommandLine::ForCurrentProcess(); 1351 *base::CommandLine::ForCurrentProcess();
1339 1352
1340 if (command_line.HasSwitch(switches::kDisableQuic)) 1353 if (command_line.HasSwitch(switches::kDisableQuic))
1341 return false; 1354 return false;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1529 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1517 for (size_t i = 0; i < supported_versions.size(); ++i) { 1530 for (size_t i = 0; i < supported_versions.size(); ++i) {
1518 net::QuicVersion version = supported_versions[i]; 1531 net::QuicVersion version = supported_versions[i];
1519 if (net::QuicVersionToString(version) == quic_version) { 1532 if (net::QuicVersionToString(version) == quic_version) {
1520 return version; 1533 return version;
1521 } 1534 }
1522 } 1535 }
1523 1536
1524 return net::QUIC_VERSION_UNSUPPORTED; 1537 return net::QUIC_VERSION_UNSUPPORTED;
1525 } 1538 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698