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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 net::CertDatabase::TrustBits trust_bits, | 124 net::CertDatabase::TrustBits trust_bits, |
125 net::CertDatabase::ImportCertFailureList* not_imported) { | 125 net::CertDatabase::ImportCertFailureList* not_imported) { |
126 bool result = cert_db_.ImportCACerts(certificates, trust_bits, not_imported); | 126 bool result = cert_db_.ImportCACerts(certificates, trust_bits, not_imported); |
127 if (result && not_imported->size() != certificates.size()) | 127 if (result && not_imported->size() != certificates.size()) |
128 Refresh(); | 128 Refresh(); |
129 return result; | 129 return result; |
130 } | 130 } |
131 | 131 |
132 bool CertificateManagerModel::ImportServerCert( | 132 bool CertificateManagerModel::ImportServerCert( |
133 const net::CertificateList& certificates, | 133 const net::CertificateList& certificates, |
| 134 net::CertDatabase::TrustBits trust_bits, |
134 net::CertDatabase::ImportCertFailureList* not_imported) { | 135 net::CertDatabase::ImportCertFailureList* not_imported) { |
135 bool result = cert_db_.ImportServerCert(certificates, not_imported); | 136 bool result = cert_db_.ImportServerCert(certificates, trust_bits, |
| 137 not_imported); |
136 if (result && not_imported->size() != certificates.size()) | 138 if (result && not_imported->size() != certificates.size()) |
137 Refresh(); | 139 Refresh(); |
138 return result; | 140 return result; |
139 } | 141 } |
140 | 142 |
141 bool CertificateManagerModel::SetCertTrust( | 143 bool CertificateManagerModel::SetCertTrust( |
142 const net::X509Certificate* cert, | 144 const net::X509Certificate* cert, |
143 net::CertType type, | 145 net::CertType type, |
144 net::CertDatabase::TrustBits trust_bits) { | 146 net::CertDatabase::TrustBits trust_bits) { |
145 return cert_db_.SetCertTrust(cert, type, trust_bits); | 147 return cert_db_.SetCertTrust(cert, type, trust_bits); |
146 } | 148 } |
147 | 149 |
148 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { | 150 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { |
149 bool result = cert_db_.DeleteCertAndKey(cert); | 151 bool result = cert_db_.DeleteCertAndKey(cert); |
150 if (result) | 152 if (result) |
151 Refresh(); | 153 Refresh(); |
152 return result; | 154 return result; |
153 } | 155 } |
154 | 156 |
155 bool CertificateManagerModel::IsHardwareBacked( | 157 bool CertificateManagerModel::IsHardwareBacked( |
156 const net::X509Certificate* cert) const { | 158 const net::X509Certificate* cert) const { |
157 #if defined(OS_CHROMEOS) | 159 #if defined(OS_CHROMEOS) |
158 return crypto::IsTPMTokenReady() && | 160 return crypto::IsTPMTokenReady() && |
159 cert->os_cert_handle()->slot == | 161 cert->os_cert_handle()->slot == |
160 cert_db().GetPrivateModule()->os_module_handle(); | 162 cert_db().GetPrivateModule()->os_module_handle(); |
161 #else | 163 #else |
162 return false; | 164 return false; |
163 #endif | 165 #endif |
164 } | 166 } |
OLD | NEW |