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

Unified Diff: chrome/browser/certificate_manager_model.cc

Issue 10916094: Move the NSS functions out of CertDatabase into a new NSSCertDatabase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/certificate_manager_model.cc
diff --git a/chrome/browser/certificate_manager_model.cc b/chrome/browser/certificate_manager_model.cc
index e44a0b6dfd6b5f38eb393f8e317e7a4685380319..9d4f2d2996906fe1e0b1331d4398ff46576c215e 100644
--- a/chrome/browser/certificate_manager_model.cc
+++ b/chrome/browser/certificate_manager_model.cc
@@ -23,7 +23,8 @@
#endif
CertificateManagerModel::CertificateManagerModel(Observer* observer)
- : observer_(observer) {
+ : cert_db_(net::NSSCertDatabase::GetInstance()),
+ observer_(observer) {
}
CertificateManagerModel::~CertificateManagerModel() {
@@ -32,7 +33,7 @@ CertificateManagerModel::~CertificateManagerModel() {
void CertificateManagerModel::Refresh() {
VLOG(1) << "refresh started";
net::CryptoModuleList modules;
- cert_db_.ListModules(&modules, false);
+ cert_db_->ListModules(&modules, false);
VLOG(1) << "refresh waiting for unlocking...";
browser::UnlockSlotsIfNecessary(
modules,
@@ -44,7 +45,7 @@ void CertificateManagerModel::Refresh() {
void CertificateManagerModel::RefreshSlotsUnlocked() {
VLOG(1) << "refresh listing certs...";
- cert_db_.ListCerts(&cert_list_);
+ cert_db_->ListCerts(&cert_list_);
observer_->CertificatesRefreshed();
VLOG(1) << "refresh finished";
}
@@ -112,8 +113,8 @@ int CertificateManagerModel::ImportFromPKCS12(net::CryptoModule* module,
const std::string& data,
const string16& password,
bool is_extractable) {
- int result = cert_db_.ImportFromPKCS12(module, data, password,
- is_extractable, NULL);
+ int result = cert_db_->ImportFromPKCS12(module, data, password,
+ is_extractable, NULL);
if (result == net::OK)
Refresh();
return result;
@@ -121,9 +122,9 @@ int CertificateManagerModel::ImportFromPKCS12(net::CryptoModule* module,
bool CertificateManagerModel::ImportCACerts(
const net::CertificateList& certificates,
- net::CertDatabase::TrustBits trust_bits,
- net::CertDatabase::ImportCertFailureList* not_imported) {
- bool result = cert_db_.ImportCACerts(certificates, trust_bits, not_imported);
+ net::NSSCertDatabase::TrustBits trust_bits,
+ net::NSSCertDatabase::ImportCertFailureList* not_imported) {
+ bool result = cert_db_->ImportCACerts(certificates, trust_bits, not_imported);
if (result && not_imported->size() != certificates.size())
Refresh();
return result;
@@ -131,10 +132,10 @@ bool CertificateManagerModel::ImportCACerts(
bool CertificateManagerModel::ImportServerCert(
const net::CertificateList& certificates,
- net::CertDatabase::TrustBits trust_bits,
- net::CertDatabase::ImportCertFailureList* not_imported) {
- bool result = cert_db_.ImportServerCert(certificates, trust_bits,
- not_imported);
+ net::NSSCertDatabase::TrustBits trust_bits,
+ net::NSSCertDatabase::ImportCertFailureList* not_imported) {
+ bool result = cert_db_->ImportServerCert(certificates, trust_bits,
+ not_imported);
if (result && not_imported->size() != certificates.size())
Refresh();
return result;
@@ -143,12 +144,12 @@ bool CertificateManagerModel::ImportServerCert(
bool CertificateManagerModel::SetCertTrust(
const net::X509Certificate* cert,
net::CertType type,
- net::CertDatabase::TrustBits trust_bits) {
- return cert_db_.SetCertTrust(cert, type, trust_bits);
+ net::NSSCertDatabase::TrustBits trust_bits) {
+ return cert_db_->SetCertTrust(cert, type, trust_bits);
}
bool CertificateManagerModel::Delete(net::X509Certificate* cert) {
- bool result = cert_db_.DeleteCertAndKey(cert);
+ bool result = cert_db_->DeleteCertAndKey(cert);
if (result)
Refresh();
return result;
@@ -159,7 +160,7 @@ bool CertificateManagerModel::IsHardwareBacked(
#if defined(OS_CHROMEOS)
return crypto::IsTPMTokenReady() &&
cert->os_cert_handle()->slot ==
- cert_db().GetPrivateModule()->os_module_handle();
+ cert_db_->GetPrivateModule()->os_module_handle();
#else
return false;
#endif

Powered by Google App Engine
This is Rietveld 408576698