Updating trunk VERSION from 1014.0 to 1015.0
[chromium-blink-merge.git] / net / base / crypto_module.h
blob2b37e864144a61eefabaab5baba701c5ec78fc38
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_
7 #pragma once
9 #include <string>
10 #include <vector>
12 #include "base/memory/ref_counted.h"
13 #include "net/base/net_export.h"
15 #if defined(USE_NSS)
16 typedef struct PK11SlotInfoStr PK11SlotInfo;
17 #endif
19 namespace net {
21 class CryptoModule;
23 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList;
25 class NET_EXPORT CryptoModule
26 : public base::RefCountedThreadSafe<CryptoModule> {
27 public:
28 #if defined(USE_NSS)
29 typedef PK11SlotInfo* OSModuleHandle;
30 #else
31 typedef void* OSModuleHandle;
32 #endif
34 OSModuleHandle os_module_handle() const { return module_handle_; }
36 std::string GetTokenName() const;
38 static CryptoModule* CreateFromHandle(OSModuleHandle handle);
40 private:
41 friend class base::RefCountedThreadSafe<CryptoModule>;
43 explicit CryptoModule(OSModuleHandle handle);
44 ~CryptoModule();
46 OSModuleHandle module_handle_;
48 DISALLOW_COPY_AND_ASSIGN(CryptoModule);
51 } // namespace net
53 #endif // NET_BASE_CRYPTO_MODULE_H_