| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 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 int CertLoader::TPMTokenSlotID() const { | 87 int CertLoader::TPMTokenSlotID() const { |
| 88 if (!database_) | 88 if (!database_) |
| 89 return -1; | 89 return -1; |
| 90 crypto::ScopedPK11Slot slot(database_->GetPrivateSlot()); | 90 crypto::ScopedPK11Slot slot(database_->GetPrivateSlot()); |
| 91 if (!slot) | 91 DCHECK(slot); |
| 92 return -1; | |
| 93 return static_cast<int>(PK11_GetSlotID(slot.get())); | 92 return static_cast<int>(PK11_GetSlotID(slot.get())); |
| 94 } | 93 } |
| 95 | 94 |
| 96 bool CertLoader::IsHardwareBacked() const { | 95 bool CertLoader::IsHardwareBacked() const { |
| 97 if (force_hardware_backed_for_test_) | 96 if (force_hardware_backed_for_test_) |
| 98 return true; | 97 return true; |
| 99 if (!database_) | 98 if (!database_) |
| 100 return false; | 99 return false; |
| 101 crypto::ScopedPK11Slot slot(database_->GetPrivateSlot()); | 100 crypto::ScopedPK11Slot slot(database_->GetPrivateSlot()); |
| 102 if (!slot) | 101 DCHECK(slot); |
| 103 return false; | |
| 104 return PK11_IsHW(slot.get()); | 102 return PK11_IsHW(slot.get()); |
| 105 } | 103 } |
| 106 | 104 |
| 107 bool CertLoader::IsCertificateHardwareBacked( | 105 bool CertLoader::IsCertificateHardwareBacked( |
| 108 const net::X509Certificate* cert) const { | 106 const net::X509Certificate* cert) const { |
| 109 if (!database_) | 107 if (!database_) |
| 110 return false; | 108 return false; |
| 111 return database_->IsHardwareBacked(cert); | 109 return database_->IsHardwareBacked(cert); |
| 112 } | 110 } |
| 113 | 111 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 VLOG(1) << "OnCertAdded"; | 191 VLOG(1) << "OnCertAdded"; |
| 194 LoadCertificates(); | 192 LoadCertificates(); |
| 195 } | 193 } |
| 196 | 194 |
| 197 void CertLoader::OnCertRemoved(const net::X509Certificate* cert) { | 195 void CertLoader::OnCertRemoved(const net::X509Certificate* cert) { |
| 198 VLOG(1) << "OnCertRemoved"; | 196 VLOG(1) << "OnCertRemoved"; |
| 199 LoadCertificates(); | 197 LoadCertificates(); |
| 200 } | 198 } |
| 201 | 199 |
| 202 } // namespace chromeos | 200 } // namespace chromeos |
| OLD | NEW |