Backed out changeset 9157ea42ff41 (bug 914925) for Android/B2G test bustage.
[gecko.git] / dom / quota / CheckQuotaHelper.h
blobfcdf61c34582c3b23337951c0414eb26380422c5
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/. */
7 #ifndef mozilla_dom_quota_checkquotahelper_h__
8 #define mozilla_dom_quota_checkquotahelper_h__
10 #include "QuotaCommon.h"
12 #include "nsIInterfaceRequestor.h"
13 #include "nsIObserver.h"
14 #include "nsIRunnable.h"
16 #include "mozilla/CondVar.h"
17 #include "mozilla/Mutex.h"
19 class nsIPrincipal;
20 class nsPIDOMWindow;
22 BEGIN_QUOTA_NAMESPACE
24 class CheckQuotaHelper MOZ_FINAL : public nsIRunnable,
25 public nsIInterfaceRequestor,
26 public nsIObserver
28 public:
29 NS_DECL_THREADSAFE_ISUPPORTS
30 NS_DECL_NSIRUNNABLE
31 NS_DECL_NSIINTERFACEREQUESTOR
32 NS_DECL_NSIOBSERVER
34 CheckQuotaHelper(nsPIDOMWindow* aWindow,
35 mozilla::Mutex& aMutex);
37 bool
38 PromptAndReturnQuotaIsDisabled();
40 void
41 Cancel();
43 static uint32_t
44 GetQuotaPermission(nsIPrincipal* aPrincipal);
46 private:
47 nsPIDOMWindow* mWindow;
49 mozilla::Mutex& mMutex;
50 mozilla::CondVar mCondVar;
51 uint32_t mPromptResult;
52 bool mWaiting;
53 bool mHasPrompted;
56 END_QUOTA_NAMESPACE
58 #endif // mozilla_dom_quota_checkquotahelper_h__