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 NSPROTECTEDAUTHTHREAD_H_ michael@0: #define NSPROTECTEDAUTHTHREAD_H_ michael@0: michael@0: #include michael@0: #include "keyhi.h" michael@0: #include "nspr.h" michael@0: michael@0: #include "mozilla/Mutex.h" michael@0: #include "nsIProtectedAuthThread.h" michael@0: michael@0: class nsIRunnable; michael@0: michael@0: class nsProtectedAuthThread : public nsIProtectedAuthThread michael@0: { michael@0: private: michael@0: mozilla::Mutex mMutex; michael@0: michael@0: nsCOMPtr mNotifyObserver; michael@0: michael@0: bool mIAmRunning; michael@0: bool mLoginReady; michael@0: michael@0: PRThread *mThreadHandle; michael@0: michael@0: // Slot to do authentication on michael@0: PK11SlotInfo* mSlot; michael@0: michael@0: // Result of the authentication michael@0: SECStatus mLoginResult; michael@0: michael@0: public: michael@0: michael@0: nsProtectedAuthThread(); michael@0: virtual ~nsProtectedAuthThread(); michael@0: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIPROTECTEDAUTHTHREAD michael@0: michael@0: // Sets parameters for the thread michael@0: void SetParams(PK11SlotInfo *slot); michael@0: michael@0: // Gets result of the protected authentication operation michael@0: SECStatus GetResult(); michael@0: michael@0: void Join(void); michael@0: michael@0: void Run(void); michael@0: }; michael@0: michael@0: #endif // NSPROTECTEDAUTHTHREAD_H_