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

Unified Diff: net/cert/cert_database.h

Issue 18121007: *WIP* Store NSS slots per profile. Move keygen to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more refactoring Created 7 years 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
« no previous file with comments | « chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp ('k') | net/cert/cert_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/third_party/mozilla_security_manager/nsNSSCertHelper.cpp ('k') | net/cert/cert_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698