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

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

Issue 6580058: NSS: Unlock crypto devices when populating cert manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review changes Created 9 years, 9 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
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 "content/browser/certificate_manager_model.h" 5 #include "content/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/browser/ui/crypto_module_password_dialog.h"
10 #include "chrome/common/net/x509_certificate_model.h" 11 #include "chrome/common/net/x509_certificate_model.h"
12 #include "net/base/crypto_module.h"
11 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
12 #include "net/base/x509_certificate.h" 14 #include "net/base/x509_certificate.h"
13 15
14 CertificateManagerModel::CertificateManagerModel(Observer* observer) 16 CertificateManagerModel::CertificateManagerModel(Observer* observer)
15 : observer_(observer) { 17 : observer_(observer) {
16 } 18 }
17 19
18 CertificateManagerModel::~CertificateManagerModel() { 20 CertificateManagerModel::~CertificateManagerModel() {
19 } 21 }
20 22
21 void CertificateManagerModel::Refresh() { 23 void CertificateManagerModel::Refresh() {
22 VLOG(1) << "refresh started"; 24 VLOG(1) << "refresh started";
25 net::CryptoModuleList modules;
26 cert_db_.ListModules(&modules, false);
27 VLOG(1) << "refresh waiting for unlocking...";
28 browser::UnlockSlotsIfNecessary(
29 modules,
30 browser::kCryptoModulePasswordListCerts,
31 "", // unused.
32 NewCallback(this,
33 &CertificateManagerModel::RefreshSlotsUnlocked));
34 }
35
36 void CertificateManagerModel::RefreshSlotsUnlocked() {
37 VLOG(1) << "refresh listing certs...";
23 cert_db_.ListCerts(&cert_list_); 38 cert_db_.ListCerts(&cert_list_);
24 observer_->CertificatesRefreshed(); 39 observer_->CertificatesRefreshed();
25 VLOG(1) << "refresh finished"; 40 VLOG(1) << "refresh finished";
26 } 41 }
27 42
28 void CertificateManagerModel::FilterAndBuildOrgGroupingMap( 43 void CertificateManagerModel::FilterAndBuildOrgGroupingMap(
29 net::CertType filter_type, 44 net::CertType filter_type,
30 CertificateManagerModel::OrgGroupingMap* map) const { 45 CertificateManagerModel::OrgGroupingMap* map) const {
31 for (net::CertificateList::const_iterator i = cert_list_.begin(); 46 for (net::CertificateList::const_iterator i = cert_list_.begin();
32 i != cert_list_.end(); ++i) { 47 i != cert_list_.end(); ++i) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 unsigned int trust_bits) { 122 unsigned int trust_bits) {
108 return cert_db_.SetCertTrust(cert, type, trust_bits); 123 return cert_db_.SetCertTrust(cert, type, trust_bits);
109 } 124 }
110 125
111 bool CertificateManagerModel::Delete(net::X509Certificate* cert) { 126 bool CertificateManagerModel::Delete(net::X509Certificate* cert) {
112 bool result = cert_db_.DeleteCertAndKey(cert); 127 bool result = cert_db_.DeleteCertAndKey(cert);
113 if (result) 128 if (result)
114 Refresh(); 129 Refresh();
115 return result; 130 return result;
116 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698