Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/certificate_manager_model.cc

Issue 7111014: [ChromeOS] Add a "hardware-backed" suffix to tpm-backed cert. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and address mattm's comments in set #1 Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/callback_old.h" 7 #include "base/callback_old.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"
11 #include "chrome/browser/ui/crypto_module_password_dialog.h" 11 #include "chrome/browser/ui/crypto_module_password_dialog.h"
12 #include "chrome/common/net/x509_certificate_model.h" 12 #include "chrome/common/net/x509_certificate_model.h"
13 #include "net/base/crypto_module.h" 13 #include "net/base/crypto_module.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/base/x509_certificate.h" 15 #include "net/base/x509_certificate.h"
16 16
17 #if defined(OS_CHROMEOS)
18 #include <cert.h>
19
20 #include "crypto/nss_util.h"
21 #include "grit/generated_resources.h"
22 #include "net/base/crypto_module.h"
23 #include "net/base/x509_certificate.h"
mattm 2011/06/06 20:47:34 these 2 already included above
24 #include "ui/base/l10n/l10n_util.h"
25 #endif
26
17 CertificateManagerModel::CertificateManagerModel(Observer* observer) 27 CertificateManagerModel::CertificateManagerModel(Observer* observer)
18 : observer_(observer) { 28 : observer_(observer) {
19 } 29 }
20 30
21 CertificateManagerModel::~CertificateManagerModel() { 31 CertificateManagerModel::~CertificateManagerModel() {
22 } 32 }
23 33
24 void CertificateManagerModel::Refresh() { 34 void CertificateManagerModel::Refresh() {
25 VLOG(1) << "refresh started"; 35 VLOG(1) << "refresh started";
26 net::CryptoModuleList modules; 36 net::CryptoModuleList modules;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 73 }
64 74
65 string16 CertificateManagerModel::GetColumnText( 75 string16 CertificateManagerModel::GetColumnText(
66 const net::X509Certificate& cert, 76 const net::X509Certificate& cert,
67 Column column) const { 77 Column column) const {
68 string16 rv; 78 string16 rv;
69 switch (column) { 79 switch (column) {
70 case COL_SUBJECT_NAME: 80 case COL_SUBJECT_NAME:
71 rv = UTF8ToUTF16( 81 rv = UTF8ToUTF16(
72 x509_certificate_model::GetCertNameOrNickname(cert.os_cert_handle())); 82 x509_certificate_model::GetCertNameOrNickname(cert.os_cert_handle()));
83
84 #if defined(OS_CHROMEOS)
85 // TODO(xiyuan): Put this into a column when we have js tree-table.
86 if (crypto::IsTPMTokenReady() &&
87 cert.os_cert_handle()->slot ==
88 cert_db().GetPrivateModule()->os_module_handle()) {
89 rv = l10n_util::GetStringFUTF16(
90 IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT,
91 rv,
92 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED));
93 }
94 #endif
73 break; 95 break;
74 case COL_CERTIFICATE_STORE: 96 case COL_CERTIFICATE_STORE:
75 rv = UTF8ToUTF16( 97 rv = UTF8ToUTF16(
76 x509_certificate_model::GetTokenName(cert.os_cert_handle())); 98 x509_certificate_model::GetTokenName(cert.os_cert_handle()));
77 break; 99 break;
78 case COL_SERIAL_NUMBER: 100 case COL_SERIAL_NUMBER:
79 rv = ASCIIToUTF16( 101 rv = ASCIIToUTF16(
80 x509_certificate_model::GetSerialNumberHexified( 102 x509_certificate_model::GetSerialNumberHexified(
81 cert.os_cert_handle(), "")); 103 cert.os_cert_handle(), ""));
82 break; 104 break;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 unsigned int trust_bits) { 145 unsigned int trust_bits) {
124 return cert_db_.SetCertTrust(cert, type, trust_bits); 146 return cert_db_.SetCertTrust(cert, type, trust_bits);
125 } 147 }
126 148
127 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { 149 bool CertificateManagerModel::Delete(net::X509Certificate* cert) {
128 bool result = cert_db_.DeleteCertAndKey(cert); 150 bool result = cert_db_.DeleteCertAndKey(cert);
129 if (result) 151 if (result)
130 Refresh(); 152 Refresh();
131 return result; 153 return result;
132 } 154 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698