| Index: net/cert/cert_database_nss.cc
|
| diff --git a/net/cert/cert_database_nss.cc b/net/cert/cert_database_nss.cc
|
| index a1677fe85a139108d22a806df2fb324405e68690..37f3870aa47ae8f2f5c22e45aca071d2eecca464 100644
|
| --- a/net/cert/cert_database_nss.cc
|
| +++ b/net/cert/cert_database_nss.cc
|
| @@ -19,19 +19,15 @@
|
|
|
| namespace net {
|
|
|
| -// Helper that observes events from the NSSCertDatabase and forwards them to
|
| +// Helper that observes events from a CertDatabaseSource and forwards them to
|
| // the given CertDatabase.
|
| -class CertDatabase::Notifier : public NSSCertDatabase::Observer {
|
| +class CertDatabase::Notifier : public CertDatabaseSource::Observer {
|
| public:
|
| - explicit Notifier(CertDatabase* cert_db) : cert_db_(cert_db) {
|
| - NSSCertDatabase::GetInstance()->AddObserver(this);
|
| - }
|
| + Notifier(CertDatabase* cert_db) : cert_db_(cert_db) {}
|
|
|
| - virtual ~Notifier() {
|
| - NSSCertDatabase::GetInstance()->RemoveObserver(this);
|
| - }
|
| + virtual ~Notifier() {}
|
|
|
| - // NSSCertDatabase::Observer implementation:
|
| + // CertDatabaseSource::Observer implementation:
|
| virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE {
|
| cert_db_->NotifyObserversOfCertAdded(cert);
|
| }
|
| @@ -51,10 +47,9 @@ class CertDatabase::Notifier : public NSSCertDatabase::Observer {
|
| };
|
|
|
| CertDatabase::CertDatabase()
|
| - : observer_list_(new ObserverListThreadSafe<Observer>) {
|
| - // Observe NSSCertDatabase events and forward them to observers of
|
| - // CertDatabase. This also makes sure that NSS has been initialized.
|
| - notifier_.reset(new Notifier(this));
|
| + : observer_list_(new ObserverListThreadSafe<Observer>),
|
| + notifier_(new Notifier(this)) {
|
| + crypto::EnsureNSSInit();
|
| }
|
|
|
| CertDatabase::~CertDatabase() {}
|
| @@ -109,4 +104,8 @@ int CertDatabase::AddUserCert(X509Certificate* cert_obj) {
|
| return OK;
|
| }
|
|
|
| +void CertDatabase::AddSource(CertDatabaseSource* source) {
|
| + source->AddObserver(this->notifier_.get());
|
| +}
|
| +
|
| } // namespace net
|
|
|