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

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 fix includes 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 "ui/base/l10n/l10n_util.h"
23 #endif
24
17 CertificateManagerModel::CertificateManagerModel(Observer* observer) 25 CertificateManagerModel::CertificateManagerModel(Observer* observer)
18 : observer_(observer) { 26 : observer_(observer) {
19 } 27 }
20 28
21 CertificateManagerModel::~CertificateManagerModel() { 29 CertificateManagerModel::~CertificateManagerModel() {
22 } 30 }
23 31
24 void CertificateManagerModel::Refresh() { 32 void CertificateManagerModel::Refresh() {
25 VLOG(1) << "refresh started"; 33 VLOG(1) << "refresh started";
26 net::CryptoModuleList modules; 34 net::CryptoModuleList modules;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 71 }
64 72
65 string16 CertificateManagerModel::GetColumnText( 73 string16 CertificateManagerModel::GetColumnText(
66 const net::X509Certificate& cert, 74 const net::X509Certificate& cert,
67 Column column) const { 75 Column column) const {
68 string16 rv; 76 string16 rv;
69 switch (column) { 77 switch (column) {
70 case COL_SUBJECT_NAME: 78 case COL_SUBJECT_NAME:
71 rv = UTF8ToUTF16( 79 rv = UTF8ToUTF16(
72 x509_certificate_model::GetCertNameOrNickname(cert.os_cert_handle())); 80 x509_certificate_model::GetCertNameOrNickname(cert.os_cert_handle()));
81
82 #if defined(OS_CHROMEOS)
83 // TODO(xiyuan): Put this into a column when we have js tree-table.
84 if (crypto::IsTPMTokenReady() &&
85 cert.os_cert_handle()->slot ==
86 cert_db().GetPrivateModule()->os_module_handle()) {
87 rv = l10n_util::GetStringFUTF16(
88 IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT,
89 rv,
90 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED));
91 }
92 #endif
73 break; 93 break;
74 case COL_CERTIFICATE_STORE: 94 case COL_CERTIFICATE_STORE:
75 rv = UTF8ToUTF16( 95 rv = UTF8ToUTF16(
76 x509_certificate_model::GetTokenName(cert.os_cert_handle())); 96 x509_certificate_model::GetTokenName(cert.os_cert_handle()));
77 break; 97 break;
78 case COL_SERIAL_NUMBER: 98 case COL_SERIAL_NUMBER:
79 rv = ASCIIToUTF16( 99 rv = ASCIIToUTF16(
80 x509_certificate_model::GetSerialNumberHexified( 100 x509_certificate_model::GetSerialNumberHexified(
81 cert.os_cert_handle(), "")); 101 cert.os_cert_handle(), ""));
82 break; 102 break;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 unsigned int trust_bits) { 143 unsigned int trust_bits) {
124 return cert_db_.SetCertTrust(cert, type, trust_bits); 144 return cert_db_.SetCertTrust(cert, type, trust_bits);
125 } 145 }
126 146
127 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { 147 bool CertificateManagerModel::Delete(net::X509Certificate* cert) {
128 bool result = cert_db_.DeleteCertAndKey(cert); 148 bool result = cert_db_.DeleteCertAndKey(cert);
129 if (result) 149 if (result)
130 Refresh(); 150 Refresh();
131 return result; 151 return result;
132 } 152 }
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