|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set ts=2 et sw=2 tw=80: */ |
|
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 |
|
7 #ifndef mozilla_dom_quota_checkquotahelper_h__ |
|
8 #define mozilla_dom_quota_checkquotahelper_h__ |
|
9 |
|
10 #include "QuotaCommon.h" |
|
11 |
|
12 #include "nsIInterfaceRequestor.h" |
|
13 #include "nsIObserver.h" |
|
14 #include "nsIRunnable.h" |
|
15 |
|
16 #include "mozilla/CondVar.h" |
|
17 #include "mozilla/Mutex.h" |
|
18 |
|
19 class nsIPrincipal; |
|
20 class nsPIDOMWindow; |
|
21 |
|
22 BEGIN_QUOTA_NAMESPACE |
|
23 |
|
24 class CheckQuotaHelper MOZ_FINAL : public nsIRunnable, |
|
25 public nsIInterfaceRequestor, |
|
26 public nsIObserver |
|
27 { |
|
28 public: |
|
29 NS_DECL_THREADSAFE_ISUPPORTS |
|
30 NS_DECL_NSIRUNNABLE |
|
31 NS_DECL_NSIINTERFACEREQUESTOR |
|
32 NS_DECL_NSIOBSERVER |
|
33 |
|
34 CheckQuotaHelper(nsPIDOMWindow* aWindow, |
|
35 mozilla::Mutex& aMutex); |
|
36 |
|
37 bool |
|
38 PromptAndReturnQuotaIsDisabled(); |
|
39 |
|
40 void |
|
41 Cancel(); |
|
42 |
|
43 static uint32_t |
|
44 GetQuotaPermission(nsIPrincipal* aPrincipal); |
|
45 |
|
46 private: |
|
47 nsPIDOMWindow* mWindow; |
|
48 |
|
49 mozilla::Mutex& mMutex; |
|
50 mozilla::CondVar mCondVar; |
|
51 uint32_t mPromptResult; |
|
52 bool mWaiting; |
|
53 bool mHasPrompted; |
|
54 }; |
|
55 |
|
56 END_QUOTA_NAMESPACE |
|
57 |
|
58 #endif // mozilla_dom_quota_checkquotahelper_h__ |