nsProtectedAuthThread.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef NSPROTECTEDAUTHTHREAD_H_
  5. #define NSPROTECTEDAUTHTHREAD_H_
  6. #include <nsCOMPtr.h>
  7. #include "keyhi.h"
  8. #include "nspr.h"
  9. #include "mozilla/Mutex.h"
  10. #include "nsIProtectedAuthThread.h"
  11. class nsIRunnable;
  12. class nsProtectedAuthThread : public nsIProtectedAuthThread
  13. {
  14. private:
  15. mozilla::Mutex mMutex;
  16. nsCOMPtr<nsIRunnable> mNotifyObserver;
  17. bool mIAmRunning;
  18. bool mLoginReady;
  19. PRThread *mThreadHandle;
  20. // Slot to do authentication on
  21. PK11SlotInfo* mSlot;
  22. // Result of the authentication
  23. SECStatus mLoginResult;
  24. public:
  25. nsProtectedAuthThread();
  26. NS_DECL_THREADSAFE_ISUPPORTS
  27. NS_DECL_NSIPROTECTEDAUTHTHREAD
  28. // Sets parameters for the thread
  29. void SetParams(PK11SlotInfo *slot);
  30. // Gets result of the protected authentication operation
  31. SECStatus GetResult();
  32. void Join(void);
  33. void Run(void);
  34. protected:
  35. virtual ~nsProtectedAuthThread();
  36. };
  37. #endif // NSPROTECTEDAUTHTHREAD_H_