michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ 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 mozilla_dom_quota_checkquotahelper_h__ michael@0: #define mozilla_dom_quota_checkquotahelper_h__ michael@0: michael@0: #include "QuotaCommon.h" michael@0: michael@0: #include "nsIInterfaceRequestor.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsIRunnable.h" michael@0: michael@0: #include "mozilla/CondVar.h" michael@0: #include "mozilla/Mutex.h" michael@0: michael@0: class nsIPrincipal; michael@0: class nsPIDOMWindow; michael@0: michael@0: BEGIN_QUOTA_NAMESPACE michael@0: michael@0: class CheckQuotaHelper MOZ_FINAL : public nsIRunnable, michael@0: public nsIInterfaceRequestor, michael@0: public nsIObserver michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIRUNNABLE michael@0: NS_DECL_NSIINTERFACEREQUESTOR michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: CheckQuotaHelper(nsPIDOMWindow* aWindow, michael@0: mozilla::Mutex& aMutex); michael@0: michael@0: bool michael@0: PromptAndReturnQuotaIsDisabled(); michael@0: michael@0: void michael@0: Cancel(); michael@0: michael@0: static uint32_t michael@0: GetQuotaPermission(nsIPrincipal* aPrincipal); michael@0: michael@0: private: michael@0: nsPIDOMWindow* mWindow; michael@0: michael@0: mozilla::Mutex& mMutex; michael@0: mozilla::CondVar mCondVar; michael@0: uint32_t mPromptResult; michael@0: bool mWaiting; michael@0: bool mHasPrompted; michael@0: }; michael@0: michael@0: END_QUOTA_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_quota_checkquotahelper_h__