Roll src/third_party/WebKit 29324ab:10b2b4a (svn 202547:202548)
[chromium-blink-merge.git] / net / base / crypto_module.h
blob164df3c778e695dbb0c3b4258c08433768f44684
1 // Copyright (c) 2011 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.
5 #ifndef NET_BASE_CRYPTO_MODULE_H_
6 #define NET_BASE_CRYPTO_MODULE_H_
8 #include <string>
9 #include <vector>
11 #include "base/memory/ref_counted.h"
12 #include "net/base/net_export.h"
14 #if defined(USE_NSS_CERTS)
15 typedef struct PK11SlotInfoStr PK11SlotInfo;
16 #endif
18 namespace net {
20 class CryptoModule;
22 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList;
24 class NET_EXPORT CryptoModule
25 : public base::RefCountedThreadSafe<CryptoModule> {
26 public:
27 #if defined(USE_NSS_CERTS)
28 typedef PK11SlotInfo* OSModuleHandle;
29 #else
30 typedef void* OSModuleHandle;
31 #endif
33 OSModuleHandle os_module_handle() const { return module_handle_; }
35 std::string GetTokenName() const;
37 static CryptoModule* CreateFromHandle(OSModuleHandle handle);
39 private:
40 friend class base::RefCountedThreadSafe<CryptoModule>;
42 explicit CryptoModule(OSModuleHandle handle);
43 ~CryptoModule();
45 OSModuleHandle module_handle_;
47 DISALLOW_COPY_AND_ASSIGN(CryptoModule);
50 } // namespace net
52 #endif // NET_BASE_CRYPTO_MODULE_H_