OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/common/net/x509_certificate_model.h" | 10 #include "chrome/common/net/x509_certificate_model.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 rv = WideToUTF16Hack( | 69 rv = WideToUTF16Hack( |
70 base::TimeFormatShortDateNumeric(cert.valid_expiry())); | 70 base::TimeFormatShortDateNumeric(cert.valid_expiry())); |
71 } | 71 } |
72 break; | 72 break; |
73 default: | 73 default: |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 } | 75 } |
76 return rv; | 76 return rv; |
77 } | 77 } |
78 | 78 |
79 int CertificateManagerModel::ImportFromPKCS12(const std::string& data, | 79 int CertificateManagerModel::ImportFromPKCS12(net::PK11Slot* slot, |
| 80 const std::string& data, |
80 const string16& password) { | 81 const string16& password) { |
81 int result = cert_db_.ImportFromPKCS12(data, password); | 82 int result = cert_db_.ImportFromPKCS12(slot, data, password); |
82 if (result == net::OK) | 83 if (result == net::OK) |
83 Refresh(); | 84 Refresh(); |
84 return result; | 85 return result; |
85 } | 86 } |
86 | 87 |
87 bool CertificateManagerModel::ImportCACerts( | 88 bool CertificateManagerModel::ImportCACerts( |
88 const net::CertificateList& certificates, | 89 const net::CertificateList& certificates, |
89 unsigned int trust_bits, | 90 unsigned int trust_bits, |
90 net::CertDatabase::ImportCertFailureList* not_imported) { | 91 net::CertDatabase::ImportCertFailureList* not_imported) { |
91 bool result = cert_db_.ImportCACerts(certificates, trust_bits, not_imported); | 92 bool result = cert_db_.ImportCACerts(certificates, trust_bits, not_imported); |
(...skipping 16 matching lines...) Expand all Loading... |
108 unsigned int trust_bits) { | 109 unsigned int trust_bits) { |
109 return cert_db_.SetCertTrust(cert, type, trust_bits); | 110 return cert_db_.SetCertTrust(cert, type, trust_bits); |
110 } | 111 } |
111 | 112 |
112 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { | 113 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { |
113 bool result = cert_db_.DeleteCertAndKey(cert); | 114 bool result = cert_db_.DeleteCertAndKey(cert); |
114 if (result) | 115 if (result) |
115 Refresh(); | 116 Refresh(); |
116 return result; | 117 return result; |
117 } | 118 } |
OLD | NEW |