nsKeygenThread.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #ifndef _NSKEYGENTHREAD_H_
  7. #define _NSKEYGENTHREAD_H_
  8. #include "keyhi.h"
  9. #include "nspr.h"
  10. #include "mozilla/Mutex.h"
  11. #include "nsIKeygenThread.h"
  12. #include "nsCOMPtr.h"
  13. class nsIRunnable;
  14. class nsKeygenThread : public nsIKeygenThread
  15. {
  16. private:
  17. mozilla::Mutex mutex;
  18. nsCOMPtr<nsIRunnable> mNotifyObserver;
  19. bool iAmRunning;
  20. bool keygenReady;
  21. bool statusDialogClosed;
  22. bool alreadyReceivedParams;
  23. SECKEYPrivateKey *privateKey;
  24. SECKEYPublicKey *publicKey;
  25. PK11SlotInfo *slot;
  26. PK11AttrFlags flags;
  27. PK11SlotInfo *altSlot;
  28. PK11AttrFlags altFlags;
  29. PK11SlotInfo *usedSlot;
  30. uint32_t keyGenMechanism;
  31. void *params;
  32. void *wincx;
  33. PRThread *threadHandle;
  34. protected:
  35. virtual ~nsKeygenThread();
  36. public:
  37. nsKeygenThread();
  38. NS_DECL_NSIKEYGENTHREAD
  39. NS_DECL_THREADSAFE_ISUPPORTS
  40. void SetParams(
  41. PK11SlotInfo *a_slot,
  42. PK11AttrFlags a_flags,
  43. PK11SlotInfo *a_alternative_slot,
  44. PK11AttrFlags a_alternative_flags,
  45. uint32_t a_keyGenMechanism,
  46. void *a_params,
  47. void *a_wincx );
  48. nsresult ConsumeResult(
  49. PK11SlotInfo **a_used_slot,
  50. SECKEYPrivateKey **a_privateKey,
  51. SECKEYPublicKey **a_publicKey);
  52. void Join(void);
  53. void Run(void);
  54. };
  55. #endif //_NSKEYGENTHREAD_H_