Index: chrome/browser/net/nss_slot_factory.h |
diff --git a/chrome/browser/net/nss_slot_factory.h b/chrome/browser/net/nss_slot_factory.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cbc7687ba3431e4ba9131ab9077b5a8ef699aba9 |
--- /dev/null |
+++ b/chrome/browser/net/nss_slot_factory.h |
@@ -0,0 +1,49 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_NET_NSS_SLOT_FACTORY_H_ |
+#define CHROME_BROWSER_NET_NSS_SLOT_FACTORY_H_ |
+ |
+#include "base/compiler_specific.h" |
+#include "base/memory/singleton.h" |
+#include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h" |
+#include "crypto/scoped_nss_types.h" |
+ |
+namespace content { |
+class BrowserContext; |
+} |
+ |
+namespace chrome { |
+ |
+// Singleton that owns (XXX?) all NSS slots and associates them with |
+// BrowserContexts. Listens for the BrowserContext's destruction notification |
+// and cleans up the associated PK11SlotInfo references. |
+class NSSSlotFactory : public BrowserContextKeyedServiceFactory { |
+ public: |
+ // Returns a reference to the public slot for |context|. |
+ static crypto::ScopedPK11Slot GetPublicSlotForBrowserContext( |
+ content::BrowserContext* context); |
+ // Returns a reference to the private slot for |context|. |
+ static crypto::ScopedPK11Slot GetPrivateSlotForBrowserContext( |
+ content::BrowserContext* context); |
+ |
+ static NSSSlotFactory* GetInstance(); |
+ |
+ protected: |
+ // BrowserContextKeyedServiceFactory: |
+ virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
+ content::BrowserContext* context) const OVERRIDE; |
+ virtual content::BrowserContext* GetBrowserContextToUse( |
+ content::BrowserContext* context) const OVERRIDE; |
+ |
+ private: |
+ friend struct DefaultSingletonTraits<NSSSlotFactory>; |
+ |
+ NSSSlotFactory(); |
+ virtual ~NSSSlotFactory(); |
+}; |
+ |
+} // namespace chrome |
+ |
+#endif // CHROME_BROWSER_NET_NSS_SLOT_FACTORY_H_ |