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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 rv = ASCIIToUTF16( | 63 rv = ASCIIToUTF16( |
64 x509_certificate_model::GetSerialNumberHexified( | 64 x509_certificate_model::GetSerialNumberHexified( |
65 cert.os_cert_handle(), "")); | 65 cert.os_cert_handle(), "")); |
66 break; | 66 break; |
67 case COL_EXPIRES_ON: | 67 case COL_EXPIRES_ON: |
68 if (!cert.valid_expiry().is_null()) { | 68 if (!cert.valid_expiry().is_null()) { |
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 case COL_EMAIL_ADDRESS: | |
74 rv = UTF8ToUTF16( | |
75 x509_certificate_model::GetEmailAddress(cert.os_cert_handle())); | |
76 break; | |
77 default: | 73 default: |
78 NOTREACHED(); | 74 NOTREACHED(); |
79 } | 75 } |
80 return rv; | 76 return rv; |
81 } | 77 } |
82 | 78 |
83 int CertificateManagerModel::ImportFromPKCS12(const std::string& data, | 79 int CertificateManagerModel::ImportFromPKCS12(const std::string& data, |
84 const string16& password) { | 80 const string16& password) { |
85 int result = cert_db_.ImportFromPKCS12(data, password); | 81 int result = cert_db_.ImportFromPKCS12(data, password); |
86 if (result == net::OK) | 82 if (result == net::OK) |
(...skipping 25 matching lines...) Expand all Loading... |
112 unsigned int trust_bits) { | 108 unsigned int trust_bits) { |
113 return cert_db_.SetCertTrust(cert, type, trust_bits); | 109 return cert_db_.SetCertTrust(cert, type, trust_bits); |
114 } | 110 } |
115 | 111 |
116 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { | 112 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { |
117 bool result = cert_db_.DeleteCertAndKey(cert); | 113 bool result = cert_db_.DeleteCertAndKey(cert); |
118 if (result) | 114 if (result) |
119 Refresh(); | 115 Refresh(); |
120 return result; | 116 return result; |
121 } | 117 } |
OLD | NEW |