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

Unified Diff: chrome/browser/net/nss_slot_factory.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: Created 7 years, 6 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: 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_

Powered by Google App Engine
This is Rietveld 408576698