| 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 | 316 |
| 317 // Return true if stale-while-revalidate support should be enabled. | 317 // Return true if stale-while-revalidate support should be enabled. |
| 318 bool IsStaleWhileRevalidateEnabled(const base::CommandLine& command_line) { | 318 bool IsStaleWhileRevalidateEnabled(const base::CommandLine& command_line) { |
| 319 if (command_line.HasSwitch(switches::kEnableStaleWhileRevalidate)) | 319 if (command_line.HasSwitch(switches::kEnableStaleWhileRevalidate)) |
| 320 return true; | 320 return true; |
| 321 const std::string group_name = | 321 const std::string group_name = |
| 322 base::FieldTrialList::FindFullName(kStaleWhileRevalidateFieldTrialName); | 322 base::FieldTrialList::FindFullName(kStaleWhileRevalidateFieldTrialName); |
| 323 return group_name == "Enabled"; | 323 return group_name == "Enabled"; |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool IsCertificateTransparencyRequiredForEV( |
| 327 const base::CommandLine& command_line) { |
| 328 const std::string group_name = |
| 329 base::FieldTrialList::FindFullName("CTRequiredForEVTrial"); |
| 330 |
| 331 if (command_line.HasSwitch(switches::kRequireCTForEV)) |
| 332 return true; |
| 333 |
| 334 return group_name == "RequirementEnforced"; |
| 335 } |
| 336 |
| 326 } // namespace | 337 } // namespace |
| 327 | 338 |
| 328 class IOThread::LoggingNetworkChangeObserver | 339 class IOThread::LoggingNetworkChangeObserver |
| 329 : public net::NetworkChangeNotifier::IPAddressObserver, | 340 : public net::NetworkChangeNotifier::IPAddressObserver, |
| 330 public net::NetworkChangeNotifier::ConnectionTypeObserver, | 341 public net::NetworkChangeNotifier::ConnectionTypeObserver, |
| 331 public net::NetworkChangeNotifier::NetworkChangeObserver { | 342 public net::NetworkChangeNotifier::NetworkChangeObserver { |
| 332 public: | 343 public: |
| 333 // |net_log| must remain valid throughout our lifetime. | 344 // |net_log| must remain valid throughout our lifetime. |
| 334 explicit LoggingNetworkChangeObserver(net::NetLog* net_log) | 345 explicit LoggingNetworkChangeObserver(net::NetLog* net_log) |
| 335 : net_log_(net_log) { | 346 : net_log_(net_log) { |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 << "Unable to decode CT public key."; | 647 << "Unable to decode CT public key."; |
| 637 scoped_ptr<net::CTLogVerifier> external_log_verifier( | 648 scoped_ptr<net::CTLogVerifier> external_log_verifier( |
| 638 net::CTLogVerifier::Create(ct_public_key_data, log_description)); | 649 net::CTLogVerifier::Create(ct_public_key_data, log_description)); |
| 639 CHECK(external_log_verifier) << "Unable to parse CT public key."; | 650 CHECK(external_log_verifier) << "Unable to parse CT public key."; |
| 640 VLOG(1) << "Adding log with description " << log_description; | 651 VLOG(1) << "Adding log with description " << log_description; |
| 641 ct_verifier->AddLog(external_log_verifier.Pass()); | 652 ct_verifier->AddLog(external_log_verifier.Pass()); |
| 642 } | 653 } |
| 643 } | 654 } |
| 644 | 655 |
| 645 net::CertPolicyEnforcer* policy_enforcer = NULL; | 656 net::CertPolicyEnforcer* policy_enforcer = NULL; |
| 646 // TODO(eranm): Control with Finch, crbug.com/437766 | 657 policy_enforcer = new net::CertPolicyEnforcer( |
| 647 if (command_line.HasSwitch(switches::kRequireCTForEV)) { | 658 kNumKnownCTLogs, IsCertificateTransparencyRequiredForEV(command_line)); |
| 648 policy_enforcer = new net::CertPolicyEnforcer(kNumKnownCTLogs, true); | |
| 649 } else { | |
| 650 policy_enforcer = new net::CertPolicyEnforcer(kNumKnownCTLogs, false); | |
| 651 } | |
| 652 globals_->cert_policy_enforcer.reset(policy_enforcer); | 659 globals_->cert_policy_enforcer.reset(policy_enforcer); |
| 653 | 660 |
| 654 globals_->ssl_config_service = GetSSLConfigService(); | 661 globals_->ssl_config_service = GetSSLConfigService(); |
| 655 | 662 |
| 656 SetupDataReductionProxy(network_delegate); | 663 SetupDataReductionProxy(network_delegate); |
| 657 | 664 |
| 658 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 665 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
| 659 globals_->host_resolver.get())); | 666 globals_->host_resolver.get())); |
| 660 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); | 667 globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); |
| 661 // For the ProxyScriptFetcher, we use a direct ProxyService. | 668 // For the ProxyScriptFetcher, we use a direct ProxyService. |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); | 1412 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); |
| 1406 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1413 for (size_t i = 0; i < supported_versions.size(); ++i) { |
| 1407 net::QuicVersion version = supported_versions[i]; | 1414 net::QuicVersion version = supported_versions[i]; |
| 1408 if (net::QuicVersionToString(version) == quic_version) { | 1415 if (net::QuicVersionToString(version) == quic_version) { |
| 1409 return version; | 1416 return version; |
| 1410 } | 1417 } |
| 1411 } | 1418 } |
| 1412 | 1419 |
| 1413 return net::QUIC_VERSION_UNSUPPORTED; | 1420 return net::QUIC_VERSION_UNSUPPORTED; |
| 1414 } | 1421 } |
| OLD | NEW |