| Index: net/cert/nss_cert_database.h
|
| diff --git a/net/cert/nss_cert_database.h b/net/cert/nss_cert_database.h
|
| index 9db1b75d973dcd84adb9390126f88b21518d1434..5a94624a4722052e4b3d7f255ef860f8d2e26bfa 100644
|
| --- a/net/cert/nss_cert_database.h
|
| +++ b/net/cert/nss_cert_database.h
|
| @@ -11,6 +11,7 @@
|
| #include "base/basictypes.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/strings/string16.h"
|
| +#include "crypto/scoped_nss_types.h"
|
| #include "net/base/net_export.h"
|
| #include "net/cert/cert_type.h"
|
| #include "net/cert/x509_certificate.h"
|
| @@ -23,34 +24,15 @@ namespace net {
|
| class CryptoModule;
|
| typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList;
|
|
|
| +//XXX what to do with this?
|
| +//make callers do filtering themselves?
|
| +// - but this also does importing and stuff, with only the primary slot.
|
| +// - should there be a separate NSSCertDatabase per profile? How does that work
|
| +// since this lives in net/ ?
|
| +//
|
| // Provides functions to manipulate the NSS certificate stores.
|
| class NET_EXPORT NSSCertDatabase {
|
| public:
|
| -
|
| - class NET_EXPORT Observer {
|
| - public:
|
| - virtual ~Observer() {}
|
| -
|
| - // Will be called when a new certificate is added.
|
| - // Called with |cert| == NULL after importing a list of certificates
|
| - // in ImportFromPKCS12().
|
| - virtual void OnCertAdded(const X509Certificate* cert) {}
|
| -
|
| - // Will be called when a certificate is removed.
|
| - virtual void OnCertRemoved(const X509Certificate* cert) {}
|
| -
|
| - // Will be called when a certificate's trust is changed.
|
| - // Called with |cert| == NULL after importing a list of certificates
|
| - // in ImportCACerts().
|
| - virtual void OnCertTrustChanged(const X509Certificate* cert) {}
|
| -
|
| - protected:
|
| - Observer() {}
|
| -
|
| - private:
|
| - DISALLOW_COPY_AND_ASSIGN(Observer);
|
| - };
|
| -
|
| // Stores per-certificate error codes for import failures.
|
| struct NET_EXPORT ImportCertFailure {
|
| public:
|
| @@ -92,7 +74,7 @@ class NET_EXPORT NSSCertDatabase {
|
|
|
| // Get a list of unique certificates in the certificate database (one
|
| // instance of all certificates).
|
| - void ListCerts(CertificateList* certs);
|
| + virtual void ListCerts(CertificateList* certs);
|
|
|
| // Get the default module for public key data.
|
| // The returned pointer must be stored in a scoped_refptr<CryptoModule>.
|
| @@ -104,7 +86,7 @@ class NET_EXPORT NSSCertDatabase {
|
|
|
| // Get all modules.
|
| // If |need_rw| is true, only writable modules will be returned.
|
| - void ListModules(CryptoModuleList* modules, bool need_rw) const;
|
| + virtual void ListModules(CryptoModuleList* modules, bool need_rw) const;
|
|
|
| // Import certificates and private keys from PKCS #12 blob into the module.
|
| // If |is_extractable| is false, mark the private key as being unextractable
|
| @@ -178,28 +160,22 @@ class NET_EXPORT NSSCertDatabase {
|
| // Check whether cert is stored in a readonly slot.
|
| bool IsReadOnly(const X509Certificate* cert) const;
|
|
|
| - // Registers |observer| to receive notifications of certificate changes. The
|
| - // thread on which this is called is the thread on which |observer| will be
|
| - // called back with notifications.
|
| - void AddObserver(Observer* observer);
|
| + protected:
|
| + NSSCertDatabase();
|
| + virtual ~NSSCertDatabase();
|
|
|
| - // Unregisters |observer| from receiving notifications. This must be called
|
| - // on the same thread on which AddObserver() was called.
|
| - void RemoveObserver(Observer* observer);
|
| + // Get private and public slots.
|
| + virtual crypto::ScopedPK11Slot GetPublicSlot() const;
|
| + virtual crypto::ScopedPK11Slot GetPrivateSlot() const;
|
|
|
| private:
|
| friend struct DefaultSingletonTraits<NSSCertDatabase>;
|
|
|
| - NSSCertDatabase();
|
| - ~NSSCertDatabase();
|
| -
|
| // Broadcasts notifications to all registered observers.
|
| void NotifyObserversOfCertAdded(const X509Certificate* cert);
|
| void NotifyObserversOfCertRemoved(const X509Certificate* cert);
|
| void NotifyObserversOfCertTrustChanged(const X509Certificate* cert);
|
|
|
| - const scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(NSSCertDatabase);
|
| };
|
|
|
|
|