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

Unified Diff: net/cert/nss_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: cert manager basics working Created 7 years, 2 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
« no previous file with comments | « net/cert/cert_database_nss.cc ('k') | net/cert/nss_cert_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « net/cert/cert_database_nss.cc ('k') | net/cert/nss_cert_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698