| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "net/base/net_api.h" | 13 #include "net/base/net_export.h" |
| 14 | 14 |
| 15 #if defined(USE_NSS) | 15 #if defined(USE_NSS) |
| 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; | 23 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList; |
| 24 | 24 |
| 25 class NET_API CryptoModule : public base::RefCountedThreadSafe<CryptoModule> { | 25 class NET_EXPORT CryptoModule |
| 26 : public base::RefCountedThreadSafe<CryptoModule> { |
| 26 public: | 27 public: |
| 27 #if defined(USE_NSS) | 28 #if defined(USE_NSS) |
| 28 typedef PK11SlotInfo* OSModuleHandle; | 29 typedef PK11SlotInfo* OSModuleHandle; |
| 29 #else | 30 #else |
| 30 typedef void* OSModuleHandle; | 31 typedef void* OSModuleHandle; |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 OSModuleHandle os_module_handle() const { return module_handle_; } | 34 OSModuleHandle os_module_handle() const { return module_handle_; } |
| 34 | 35 |
| 35 std::string GetTokenName() const; | 36 std::string GetTokenName() const; |
| 36 | 37 |
| 37 static CryptoModule* CreateFromHandle(OSModuleHandle handle); | 38 static CryptoModule* CreateFromHandle(OSModuleHandle handle); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 friend class base::RefCountedThreadSafe<CryptoModule>; | 41 friend class base::RefCountedThreadSafe<CryptoModule>; |
| 41 | 42 |
| 42 explicit CryptoModule(OSModuleHandle handle); | 43 explicit CryptoModule(OSModuleHandle handle); |
| 43 ~CryptoModule(); | 44 ~CryptoModule(); |
| 44 | 45 |
| 45 OSModuleHandle module_handle_; | 46 OSModuleHandle module_handle_; |
| 46 | 47 |
| 47 DISALLOW_COPY_AND_ASSIGN(CryptoModule); | 48 DISALLOW_COPY_AND_ASSIGN(CryptoModule); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace net | 51 } // namespace net |
| 51 | 52 |
| 52 #endif // NET_BASE_CRYPTO_MODULE_H_ | 53 #endif // NET_BASE_CRYPTO_MODULE_H_ |
| OLD | NEW |