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..b136557254237f3609e9e05dc9bd9395fe34579e |
--- /dev/null |
+++ b/chrome/browser/net/nss_slot_factory.h |
@@ -0,0 +1,45 @@ |
+// 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; |
+} |
+ |
+// Singleton that associates NSS slots 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(); |
+}; |
+ |
+#endif // CHROME_BROWSER_NET_NSS_SLOT_FACTORY_H_ |