OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chromeos/cert_loader.h" | 5 #include "chromeos/cert_loader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void CertLoader::RemoveObserver(CertLoader::Observer* observer) { | 83 void CertLoader::RemoveObserver(CertLoader::Observer* observer) { |
84 observers_.RemoveObserver(observer); | 84 observers_.RemoveObserver(observer); |
85 } | 85 } |
86 | 86 |
87 bool CertLoader::IsHardwareBacked() const { | 87 bool CertLoader::IsHardwareBacked() const { |
88 if (force_hardware_backed_for_test_) | 88 if (force_hardware_backed_for_test_) |
89 return true; | 89 return true; |
90 if (!database_) | 90 if (!database_) |
91 return false; | 91 return false; |
92 crypto::ScopedPK11Slot slot(database_->GetPrivateSlot()); | 92 crypto::ScopedPK11Slot slot(database_->GetPrivateSlot()); |
93 DCHECK(slot); | 93 if (!slot) |
| 94 return false; |
94 return PK11_IsHW(slot.get()); | 95 return PK11_IsHW(slot.get()); |
95 } | 96 } |
96 | 97 |
97 bool CertLoader::IsCertificateHardwareBacked( | 98 bool CertLoader::IsCertificateHardwareBacked( |
98 const net::X509Certificate* cert) const { | 99 const net::X509Certificate* cert) const { |
99 if (!database_) | 100 if (!database_) |
100 return false; | 101 return false; |
101 return database_->IsHardwareBacked(cert); | 102 return database_->IsHardwareBacked(cert); |
102 } | 103 } |
103 | 104 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 VLOG(1) << "OnCertAdded"; | 190 VLOG(1) << "OnCertAdded"; |
190 LoadCertificates(); | 191 LoadCertificates(); |
191 } | 192 } |
192 | 193 |
193 void CertLoader::OnCertRemoved(const net::X509Certificate* cert) { | 194 void CertLoader::OnCertRemoved(const net::X509Certificate* cert) { |
194 VLOG(1) << "OnCertRemoved"; | 195 VLOG(1) << "OnCertRemoved"; |
195 LoadCertificates(); | 196 LoadCertificates(); |
196 } | 197 } |
197 | 198 |
198 } // namespace chromeos | 199 } // namespace chromeos |
OLD | NEW |