michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _NSKEYGENTHREAD_H_ michael@0: #define _NSKEYGENTHREAD_H_ michael@0: michael@0: #include "keyhi.h" michael@0: #include "nspr.h" michael@0: michael@0: #include "mozilla/Mutex.h" michael@0: #include "nsIKeygenThread.h" michael@0: #include "nsCOMPtr.h" michael@0: michael@0: class nsIRunnable; michael@0: michael@0: class nsKeygenThread : public nsIKeygenThread michael@0: { michael@0: private: michael@0: mozilla::Mutex mutex; michael@0: michael@0: nsCOMPtr mNotifyObserver; michael@0: michael@0: bool iAmRunning; michael@0: bool keygenReady; michael@0: bool statusDialogClosed; michael@0: bool alreadyReceivedParams; michael@0: michael@0: SECKEYPrivateKey *privateKey; michael@0: SECKEYPublicKey *publicKey; michael@0: PK11SlotInfo *slot; michael@0: PK11AttrFlags flags; michael@0: PK11SlotInfo *altSlot; michael@0: PK11AttrFlags altFlags; michael@0: PK11SlotInfo *usedSlot; michael@0: uint32_t keyGenMechanism; michael@0: void *params; michael@0: void *wincx; michael@0: michael@0: PRThread *threadHandle; michael@0: michael@0: public: michael@0: nsKeygenThread(); michael@0: virtual ~nsKeygenThread(); michael@0: michael@0: NS_DECL_NSIKEYGENTHREAD michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: michael@0: void SetParams( michael@0: PK11SlotInfo *a_slot, michael@0: PK11AttrFlags a_flags, michael@0: PK11SlotInfo *a_alternative_slot, michael@0: PK11AttrFlags a_alternative_flags, michael@0: uint32_t a_keyGenMechanism, michael@0: void *a_params, michael@0: void *a_wincx ); michael@0: michael@0: nsresult ConsumeResult( michael@0: PK11SlotInfo **a_used_slot, michael@0: SECKEYPrivateKey **a_privateKey, michael@0: SECKEYPublicKey **a_publicKey); michael@0: michael@0: void Join(void); michael@0: michael@0: void Run(void); michael@0: }; michael@0: michael@0: #endif //_NSKEYGENTHREAD_H_