OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_NET_NSS_SLOT_FACTORY_H_ |
| 6 #define CHROME_BROWSER_NET_NSS_SLOT_FACTORY_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/singleton.h" |
| 10 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" |
| 11 #include "crypto/scoped_nss_types.h" |
| 12 |
| 13 namespace content { |
| 14 class BrowserContext; |
| 15 } |
| 16 |
| 17 namespace chrome { |
| 18 |
| 19 // Singleton that owns (XXX?) all NSS slots and associates them with |
| 20 // BrowserContexts. Listens for the BrowserContext's destruction notification |
| 21 // and cleans up the associated PK11SlotInfo references. |
| 22 class NSSSlotFactory : public BrowserContextKeyedServiceFactory { |
| 23 public: |
| 24 // Returns a reference to the public slot for |context|. |
| 25 static crypto::ScopedPK11Slot GetPublicSlotForBrowserContext( |
| 26 content::BrowserContext* context); |
| 27 // Returns a reference to the private slot for |context|. |
| 28 static crypto::ScopedPK11Slot GetPrivateSlotForBrowserContext( |
| 29 content::BrowserContext* context); |
| 30 |
| 31 static NSSSlotFactory* GetInstance(); |
| 32 |
| 33 protected: |
| 34 // BrowserContextKeyedServiceFactory: |
| 35 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
| 36 content::BrowserContext* context) const OVERRIDE; |
| 37 virtual content::BrowserContext* GetBrowserContextToUse( |
| 38 content::BrowserContext* context) const OVERRIDE; |
| 39 |
| 40 private: |
| 41 friend struct DefaultSingletonTraits<NSSSlotFactory>; |
| 42 |
| 43 NSSSlotFactory(); |
| 44 virtual ~NSSSlotFactory(); |
| 45 }; |
| 46 |
| 47 } // namespace chrome |
| 48 |
| 49 #endif // CHROME_BROWSER_NET_NSS_SLOT_FACTORY_H_ |
OLD | NEW |