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

Unified Diff: crypto/nss_crypto_module_delegate.h

Issue 2898573002: Refactor client cert private key handling. (Closed)
Patch Set: . Created 3 years, 7 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
Index: crypto/nss_crypto_module_delegate.h
diff --git a/crypto/nss_crypto_module_delegate.h b/crypto/nss_crypto_module_delegate.h
index cf08f2859ffb547696638b1508d899290652f9ba..c955adaf8aa0f7296e3f3c4c1ab5d043f3ed7fc2 100644
--- a/crypto/nss_crypto_module_delegate.h
+++ b/crypto/nss_crypto_module_delegate.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/callback_forward.h"
+#include "base/memory/ref_counted.h"
#include "crypto/scoped_nss_types.h"
namespace crypto {
@@ -17,9 +18,9 @@ namespace crypto {
// user data argument (|wincx|) to relevant NSS functions, which the global
// password handler will call to do the actual work. This delegate should only
// be used in NSS calls on worker threads due to the blocking nature.
-class CryptoModuleBlockingPasswordDelegate {
+class CryptoModuleBlockingPasswordDelegate
+ : public base::RefCountedThreadSafe<CryptoModuleBlockingPasswordDelegate> {
public:
- virtual ~CryptoModuleBlockingPasswordDelegate() {}
// Return a value suitable for passing to the |wincx| argument of relevant NSS
// functions. This should be used instead of passing the object pointer
@@ -35,16 +36,24 @@ class CryptoModuleBlockingPasswordDelegate {
// user entered.
virtual std::string RequestPassword(const std::string& slot_name, bool retry,
bool* cancelled) = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<CryptoModuleBlockingPasswordDelegate>;
+
+ virtual ~CryptoModuleBlockingPasswordDelegate() {}
};
// Extends CryptoModuleBlockingPasswordDelegate with the ability to return a
// slot in which to act. (Eg, which slot to store a generated key in.)
class NSSCryptoModuleDelegate : public CryptoModuleBlockingPasswordDelegate {
public:
- ~NSSCryptoModuleDelegate() override {}
-
// Get the slot to store the generated key.
virtual ScopedPK11Slot RequestSlot() = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<NSSCryptoModuleDelegate>;
+
+ ~NSSCryptoModuleDelegate() override {}
};
} // namespace crypto

Powered by Google App Engine
This is Rietveld 408576698