dom/quota/CheckQuotaHelper.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/quota/CheckQuotaHelper.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_dom_quota_checkquotahelper_h__
    1.11 +#define mozilla_dom_quota_checkquotahelper_h__
    1.12 +
    1.13 +#include "QuotaCommon.h"
    1.14 +
    1.15 +#include "nsIInterfaceRequestor.h"
    1.16 +#include "nsIObserver.h"
    1.17 +#include "nsIRunnable.h"
    1.18 +
    1.19 +#include "mozilla/CondVar.h"
    1.20 +#include "mozilla/Mutex.h"
    1.21 +
    1.22 +class nsIPrincipal;
    1.23 +class nsPIDOMWindow;
    1.24 +
    1.25 +BEGIN_QUOTA_NAMESPACE
    1.26 +
    1.27 +class CheckQuotaHelper MOZ_FINAL : public nsIRunnable,
    1.28 +                                   public nsIInterfaceRequestor,
    1.29 +                                   public nsIObserver
    1.30 +{
    1.31 +public:
    1.32 +  NS_DECL_THREADSAFE_ISUPPORTS
    1.33 +  NS_DECL_NSIRUNNABLE
    1.34 +  NS_DECL_NSIINTERFACEREQUESTOR
    1.35 +  NS_DECL_NSIOBSERVER
    1.36 +
    1.37 +  CheckQuotaHelper(nsPIDOMWindow* aWindow,
    1.38 +                   mozilla::Mutex& aMutex);
    1.39 +
    1.40 +  bool
    1.41 +  PromptAndReturnQuotaIsDisabled();
    1.42 +
    1.43 +  void
    1.44 +  Cancel();
    1.45 +
    1.46 +  static uint32_t
    1.47 +  GetQuotaPermission(nsIPrincipal* aPrincipal);
    1.48 +
    1.49 +private:
    1.50 +  nsPIDOMWindow* mWindow;
    1.51 +
    1.52 +  mozilla::Mutex& mMutex;
    1.53 +  mozilla::CondVar mCondVar;
    1.54 +  uint32_t mPromptResult;
    1.55 +  bool mWaiting;
    1.56 +  bool mHasPrompted;
    1.57 +};
    1.58 +
    1.59 +END_QUOTA_NAMESPACE
    1.60 +
    1.61 +#endif // mozilla_dom_quota_checkquotahelper_h__

mercurial