| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 denied_.erase(cert->fingerprint()); | 116 denied_.erase(cert->fingerprint()); |
| 117 allowed_.insert(cert->fingerprint()); | 117 allowed_.insert(cert->fingerprint()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void X509Certificate::Policy::Deny(X509Certificate* cert) { | 120 void X509Certificate::Policy::Deny(X509Certificate* cert) { |
| 121 // Put the cert in the denied set and (maybe) remove it from the allowed set. | 121 // Put the cert in the denied set and (maybe) remove it from the allowed set. |
| 122 allowed_.erase(cert->fingerprint()); | 122 allowed_.erase(cert->fingerprint()); |
| 123 denied_.insert(cert->fingerprint()); | 123 denied_.insert(cert->fingerprint()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool X509Certificate::Policy::HasAllowedCert() const { |
| 127 return !allowed_.empty(); |
| 128 } |
| 129 |
| 130 bool X509Certificate::Policy::HasDeniedCert() const { |
| 131 return !denied_.empty(); |
| 132 } |
| 133 |
| 126 // static | 134 // static |
| 127 X509Certificate* X509Certificate::CreateFromHandle(OSCertHandle cert_handle, | 135 X509Certificate* X509Certificate::CreateFromHandle(OSCertHandle cert_handle, |
| 128 Source source) { | 136 Source source) { |
| 129 DCHECK(cert_handle); | 137 DCHECK(cert_handle); |
| 130 DCHECK(source != SOURCE_UNUSED); | 138 DCHECK(source != SOURCE_UNUSED); |
| 131 | 139 |
| 132 // Check if we already have this certificate in memory. | 140 // Check if we already have this certificate in memory. |
| 133 X509Certificate::Cache* cache = X509Certificate::Cache::GetInstance(); | 141 X509Certificate::Cache* cache = X509Certificate::Cache::GetInstance(); |
| 134 X509Certificate* cached_cert = | 142 X509Certificate* cached_cert = |
| 135 cache->Find(CalculateFingerprint(cert_handle)); | 143 cache->Find(CalculateFingerprint(cert_handle)); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 194 |
| 187 #if defined(OS_LINUX) | 195 #if defined(OS_LINUX) |
| 188 // TODO(port): Implement properly on Linux. | 196 // TODO(port): Implement properly on Linux. |
| 189 bool X509Certificate::IsEV(int status) const { | 197 bool X509Certificate::IsEV(int status) const { |
| 190 NOTIMPLEMENTED(); | 198 NOTIMPLEMENTED(); |
| 191 return true; | 199 return true; |
| 192 } | 200 } |
| 193 #endif | 201 #endif |
| 194 | 202 |
| 195 } // namespace net | 203 } // namespace net |
| OLD | NEW |