| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_BASE_CRYPTO_MODULE_H_ | 5 #ifndef NET_BASE_CRYPTO_MODULE_H_ |
| 6 #define NET_BASE_CRYPTO_MODULE_H_ | 6 #define NET_BASE_CRYPTO_MODULE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
| 14 | 14 |
| 15 #if defined(USE_NSS_CERTS) | 15 #if defined(USE_NSS_CERTS) |
| 16 typedef struct PK11SlotInfoStr PK11SlotInfo; | 16 typedef struct PK11SlotInfoStr PK11SlotInfo; |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 class CryptoModule; | 21 class CryptoModule; |
| 22 | 22 |
| 23 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList; | |
| 24 | |
| 25 class NET_EXPORT CryptoModule | 23 class NET_EXPORT CryptoModule |
| 26 : public base::RefCountedThreadSafe<CryptoModule> { | 24 : public base::RefCountedThreadSafe<CryptoModule> { |
| 27 public: | 25 public: |
| 28 #if defined(USE_NSS_CERTS) | 26 #if defined(USE_NSS_CERTS) |
| 29 typedef PK11SlotInfo* OSModuleHandle; | 27 typedef PK11SlotInfo* OSModuleHandle; |
| 30 #else | 28 #else |
| 31 typedef void* OSModuleHandle; | 29 typedef void* OSModuleHandle; |
| 32 #endif | 30 #endif |
| 33 | 31 |
| 34 OSModuleHandle os_module_handle() const { return module_handle_; } | 32 OSModuleHandle os_module_handle() const { return module_handle_; } |
| 35 | 33 |
| 36 std::string GetTokenName() const; | 34 std::string GetTokenName() const; |
| 37 | 35 |
| 38 static CryptoModule* CreateFromHandle(OSModuleHandle handle); | 36 static CryptoModule* CreateFromHandle(OSModuleHandle handle); |
| 39 | 37 |
| 40 private: | 38 private: |
| 41 friend class base::RefCountedThreadSafe<CryptoModule>; | 39 friend class base::RefCountedThreadSafe<CryptoModule>; |
| 42 | 40 |
| 43 explicit CryptoModule(OSModuleHandle handle); | 41 explicit CryptoModule(OSModuleHandle handle); |
| 44 ~CryptoModule(); | 42 ~CryptoModule(); |
| 45 | 43 |
| 46 OSModuleHandle module_handle_; | 44 OSModuleHandle module_handle_; |
| 47 | 45 |
| 48 DISALLOW_COPY_AND_ASSIGN(CryptoModule); | 46 DISALLOW_COPY_AND_ASSIGN(CryptoModule); |
| 49 }; | 47 }; |
| 50 | 48 |
| 51 } // namespace net | 49 } // namespace net |
| 52 | 50 |
| 53 #endif // NET_BASE_CRYPTO_MODULE_H_ | 51 #endif // NET_BASE_CRYPTO_MODULE_H_ |
| OLD | NEW |