dom/quota/CheckQuotaHelper.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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
    27 {
    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;
    54 };
    56 END_QUOTA_NAMESPACE
    58 #endif // mozilla_dom_quota_checkquotahelper_h__

mercurial