OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/ssl_config_service.h" | 5 #include "net/base/ssl_config_service.h" |
6 | 6 |
| 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "net/base/crl_set.h" |
7 #include "net/base/ssl_config_service_defaults.h" | 10 #include "net/base/ssl_config_service_defaults.h" |
8 #include "net/base/ssl_false_start_blacklist.h" | 11 #include "net/base/ssl_false_start_blacklist.h" |
9 | 12 |
10 namespace net { | 13 namespace net { |
11 | 14 |
12 SSLConfig::CertAndStatus::CertAndStatus() : cert_status(0) {} | 15 SSLConfig::CertAndStatus::CertAndStatus() : cert_status(0) {} |
13 | 16 |
14 SSLConfig::CertAndStatus::~CertAndStatus() {} | 17 SSLConfig::CertAndStatus::~CertAndStatus() {} |
15 | 18 |
16 SSLConfig::SSLConfig() | 19 SSLConfig::SSLConfig() |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // static | 55 // static |
53 bool SSLConfigService::IsKnownFalseStartIncompatibleServer( | 56 bool SSLConfigService::IsKnownFalseStartIncompatibleServer( |
54 const std::string& hostname) { | 57 const std::string& hostname) { |
55 return SSLFalseStartBlacklist::IsMember(hostname); | 58 return SSLFalseStartBlacklist::IsMember(hostname); |
56 } | 59 } |
57 | 60 |
58 static bool g_cached_info_enabled = false; | 61 static bool g_cached_info_enabled = false; |
59 static bool g_origin_bound_certs_enabled = false; | 62 static bool g_origin_bound_certs_enabled = false; |
60 static bool g_false_start_enabled = true; | 63 static bool g_false_start_enabled = true; |
61 static bool g_dns_cert_provenance_checking = false; | 64 static bool g_dns_cert_provenance_checking = false; |
| 65 base::LazyInstance<scoped_refptr<CRLSet>, |
| 66 base::LeakyLazyInstanceTraits<scoped_refptr<CRLSet> > > |
| 67 g_crl_set(base::LINKER_INITIALIZED); |
62 | 68 |
63 // static | 69 // static |
64 void SSLConfigService::DisableFalseStart() { | 70 void SSLConfigService::DisableFalseStart() { |
65 g_false_start_enabled = false; | 71 g_false_start_enabled = false; |
66 } | 72 } |
67 | 73 |
68 // static | 74 // static |
69 bool SSLConfigService::false_start_enabled() { | 75 bool SSLConfigService::false_start_enabled() { |
70 return g_false_start_enabled; | 76 return g_false_start_enabled; |
71 } | 77 } |
72 | 78 |
73 // static | 79 // static |
74 void SSLConfigService::EnableDNSCertProvenanceChecking() { | 80 void SSLConfigService::EnableDNSCertProvenanceChecking() { |
75 g_dns_cert_provenance_checking = true; | 81 g_dns_cert_provenance_checking = true; |
76 } | 82 } |
77 | 83 |
78 // static | 84 // static |
79 bool SSLConfigService::dns_cert_provenance_checking_enabled() { | 85 bool SSLConfigService::dns_cert_provenance_checking_enabled() { |
80 return g_dns_cert_provenance_checking; | 86 return g_dns_cert_provenance_checking; |
81 } | 87 } |
82 | 88 |
83 // static | 89 // static |
84 void SSLConfigService::SetCRLSet(scoped_refptr<CRLSet> crl_set) { | 90 void SSLConfigService::SetCRLSet(scoped_refptr<CRLSet> crl_set) { |
85 // TODO(agl): not implemented yet. | 91 g_crl_set.Get() = crl_set; |
86 } | 92 } |
87 | 93 |
88 // static | 94 // static |
89 scoped_refptr<CRLSet> SSLConfigService::GetCRLSet() { | 95 scoped_refptr<CRLSet> SSLConfigService::GetCRLSet() { |
90 // TODO(agl): not implemented yet. | 96 return g_crl_set.Get(); |
91 scoped_refptr<CRLSet> ret; | |
92 return ret; | |
93 } | 97 } |
94 | 98 |
95 void SSLConfigService::EnableCachedInfo() { | 99 void SSLConfigService::EnableCachedInfo() { |
96 g_cached_info_enabled = true; | 100 g_cached_info_enabled = true; |
97 } | 101 } |
98 | 102 |
99 // static | 103 // static |
100 bool SSLConfigService::cached_info_enabled() { | 104 bool SSLConfigService::cached_info_enabled() { |
101 return g_cached_info_enabled; | 105 return g_cached_info_enabled; |
102 } | 106 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 bool SSLConfigService::IsSNIAvailable(SSLConfigService* service) { | 152 bool SSLConfigService::IsSNIAvailable(SSLConfigService* service) { |
149 if (!service) | 153 if (!service) |
150 return false; | 154 return false; |
151 | 155 |
152 SSLConfig ssl_config; | 156 SSLConfig ssl_config; |
153 service->GetSSLConfig(&ssl_config); | 157 service->GetSSLConfig(&ssl_config); |
154 return ssl_config.tls1_enabled; | 158 return ssl_config.tls1_enabled; |
155 } | 159 } |
156 | 160 |
157 } // namespace net | 161 } // namespace net |
OLD | NEW |