| 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/certificate_manager_model.h" | 5 #include "chrome/browser/certificate_manager_model.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 CertificateManagerModel::~CertificateManagerModel() { | 30 CertificateManagerModel::~CertificateManagerModel() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 void CertificateManagerModel::Refresh() { | 33 void CertificateManagerModel::Refresh() { |
| 34 VLOG(1) << "refresh started"; | 34 VLOG(1) << "refresh started"; |
| 35 net::CryptoModuleList modules; | 35 net::CryptoModuleList modules; |
| 36 cert_db_->ListModules(&modules, false); | 36 cert_db_->ListModules(&modules, false); |
| 37 VLOG(1) << "refresh waiting for unlocking..."; | 37 VLOG(1) << "refresh waiting for unlocking..."; |
| 38 browser::UnlockSlotsIfNecessary( | 38 chrome::UnlockSlotsIfNecessary( |
| 39 modules, | 39 modules, |
| 40 browser::kCryptoModulePasswordListCerts, | 40 chrome::kCryptoModulePasswordListCerts, |
| 41 "", // unused. | 41 "", // unused. |
| 42 base::Bind(&CertificateManagerModel::RefreshSlotsUnlocked, | 42 base::Bind(&CertificateManagerModel::RefreshSlotsUnlocked, |
| 43 base::Unretained(this))); | 43 base::Unretained(this))); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void CertificateManagerModel::RefreshSlotsUnlocked() { | 46 void CertificateManagerModel::RefreshSlotsUnlocked() { |
| 47 VLOG(1) << "refresh listing certs..."; | 47 VLOG(1) << "refresh listing certs..."; |
| 48 cert_db_->ListCerts(&cert_list_); | 48 cert_db_->ListCerts(&cert_list_); |
| 49 observer_->CertificatesRefreshed(); | 49 observer_->CertificatesRefreshed(); |
| 50 VLOG(1) << "refresh finished"; | 50 VLOG(1) << "refresh finished"; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 bool CertificateManagerModel::IsHardwareBacked( | 158 bool CertificateManagerModel::IsHardwareBacked( |
| 159 const net::X509Certificate* cert) const { | 159 const net::X509Certificate* cert) const { |
| 160 #if defined(OS_CHROMEOS) | 160 #if defined(OS_CHROMEOS) |
| 161 return crypto::IsTPMTokenReady() && | 161 return crypto::IsTPMTokenReady() && |
| 162 cert->os_cert_handle()->slot == | 162 cert->os_cert_handle()->slot == |
| 163 cert_db_->GetPrivateModule()->os_module_handle(); | 163 cert_db_->GetPrivateModule()->os_module_handle(); |
| 164 #else | 164 #else |
| 165 return false; | 165 return false; |
| 166 #endif | 166 #endif |
| 167 } | 167 } |
| OLD | NEW |