| Index: net/cert/cert_database.h
|
| diff --git a/net/cert/cert_database.h b/net/cert/cert_database.h
|
| index feadf4c1d0856d8795cc9f0690fd84000414e090..352376d673e9d70a23927a689c5dbd9a04aacc44 100644
|
| --- a/net/cert/cert_database.h
|
| +++ b/net/cert/cert_database.h
|
| @@ -16,14 +16,7 @@ template <class ObserverType> class ObserverListThreadSafe;
|
|
|
| namespace net {
|
|
|
| -// This class provides cross-platform functions to verify and add user
|
| -// certificates, and to observe changes to the underlying certificate stores.
|
| -
|
| -// TODO(gauravsh): This class could be augmented with methods
|
| -// for all operations that manipulate the underlying system
|
| -// certificate store.
|
| -
|
| -class NET_EXPORT CertDatabase {
|
| +class NET_EXPORT CertDatabaseSource {
|
| public:
|
| // A CertDatabase::Observer will be notified on certificate database changes.
|
| // The change could be either a new user certificate is added or trust on
|
| @@ -51,6 +44,25 @@ class NET_EXPORT CertDatabase {
|
| DISALLOW_COPY_AND_ASSIGN(Observer);
|
| };
|
|
|
| + // 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.
|
| + virtual void AddObserver(Observer* observer) = 0;
|
| +
|
| + // Unregisters |observer| from receiving notifications. This must be called
|
| + // on the same thread on which AddObserver() was called.
|
| + virtual void RemoveObserver(Observer* observer) = 0;
|
| +};
|
| +
|
| +// This class provides cross-platform functions to verify and add user
|
| +// certificates, and to observe changes to the underlying certificate stores.
|
| +
|
| +// TODO(gauravsh): This class could be augmented with methods
|
| +// for all operations that manipulate the underlying system
|
| +// certificate store.
|
| +
|
| +class NET_EXPORT CertDatabase : public CertDatabaseSource {
|
| + public:
|
| // Returns the CertDatabase singleton.
|
| static CertDatabase* GetInstance();
|
|
|
| @@ -63,14 +75,9 @@ class NET_EXPORT CertDatabase {
|
| // the platform cert database, or possibly other network error codes.
|
| int AddUserCert(X509Certificate* cert);
|
|
|
| - // 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);
|
| -
|
| - // Unregisters |observer| from receiving notifications. This must be called
|
| - // on the same thread on which AddObserver() was called.
|
| - void RemoveObserver(Observer* observer);
|
| + // CertDatabaseSource implementation:
|
| + virtual void AddObserver(Observer* observer) OVERRIDE;
|
| + virtual void RemoveObserver(Observer* observer) OVERRIDE;
|
|
|
| #if defined(OS_MACOSX) && !defined(OS_IOS)
|
| // Configures the current message loop to observe and forward events from
|
| @@ -85,11 +92,18 @@ class NET_EXPORT CertDatabase {
|
| void OnAndroidKeyChainChanged();
|
| #endif
|
|
|
| +#if defined(USE_NSS)
|
| + // Observe events and forward them to observers of this
|
| + // CertDatabase. It is assumed that the CertDatabase will outlive the
|
| + // source, so we don't need to bother with unregistering. //XXX
|
| + void AddSource(CertDatabaseSource* source);
|
| +#endif
|
| +
|
| private:
|
| friend struct DefaultSingletonTraits<CertDatabase>;
|
|
|
| CertDatabase();
|
| - ~CertDatabase();
|
| + virtual ~CertDatabase();
|
|
|
| // Broadcasts notifications to all registered observers.
|
| void NotifyObserversOfCertAdded(const X509Certificate* cert);
|
|
|