|
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 |
|
5 #ifndef NSPROTECTEDAUTHTHREAD_H_ |
|
6 #define NSPROTECTEDAUTHTHREAD_H_ |
|
7 |
|
8 #include <nsCOMPtr.h> |
|
9 #include "keyhi.h" |
|
10 #include "nspr.h" |
|
11 |
|
12 #include "mozilla/Mutex.h" |
|
13 #include "nsIProtectedAuthThread.h" |
|
14 |
|
15 class nsIRunnable; |
|
16 |
|
17 class nsProtectedAuthThread : public nsIProtectedAuthThread |
|
18 { |
|
19 private: |
|
20 mozilla::Mutex mMutex; |
|
21 |
|
22 nsCOMPtr<nsIRunnable> mNotifyObserver; |
|
23 |
|
24 bool mIAmRunning; |
|
25 bool mLoginReady; |
|
26 |
|
27 PRThread *mThreadHandle; |
|
28 |
|
29 // Slot to do authentication on |
|
30 PK11SlotInfo* mSlot; |
|
31 |
|
32 // Result of the authentication |
|
33 SECStatus mLoginResult; |
|
34 |
|
35 public: |
|
36 |
|
37 nsProtectedAuthThread(); |
|
38 virtual ~nsProtectedAuthThread(); |
|
39 |
|
40 NS_DECL_THREADSAFE_ISUPPORTS |
|
41 NS_DECL_NSIPROTECTEDAUTHTHREAD |
|
42 |
|
43 // Sets parameters for the thread |
|
44 void SetParams(PK11SlotInfo *slot); |
|
45 |
|
46 // Gets result of the protected authentication operation |
|
47 SECStatus GetResult(); |
|
48 |
|
49 void Join(void); |
|
50 |
|
51 void Run(void); |
|
52 }; |
|
53 |
|
54 #endif // NSPROTECTEDAUTHTHREAD_H_ |