Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / indexedDB / CheckPermissionsHelper.h
blobed6214ace67133d614d69041205544942fe708ba
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_indexeddb_checkpermissionshelper_h__
8 #define mozilla_dom_indexeddb_checkpermissionshelper_h__
10 // Only meant to be included in IndexedDB source files, not exported.
11 #include "OpenDatabaseHelper.h"
13 #include "nsIInterfaceRequestor.h"
14 #include "nsIObserver.h"
15 #include "nsIRunnable.h"
17 class nsIDOMWindow;
18 class nsIThread;
20 BEGIN_INDEXEDDB_NAMESPACE
22 class CheckPermissionsHelper MOZ_FINAL : public nsIRunnable,
23 public nsIInterfaceRequestor,
24 public nsIObserver
26 public:
27 NS_DECL_THREADSAFE_ISUPPORTS
28 NS_DECL_NSIRUNNABLE
29 NS_DECL_NSIINTERFACEREQUESTOR
30 NS_DECL_NSIOBSERVER
32 CheckPermissionsHelper(OpenDatabaseHelper* aHelper,
33 nsIDOMWindow* aWindow)
34 : mHelper(aHelper),
35 mWindow(aWindow),
36 // If we're trying to delete the database, we should never prompt the user.
37 // Anything that would prompt is translated to denied.
38 mPromptAllowed(!aHelper->mForDeletion),
39 mHasPrompted(false),
40 mPromptResult(0)
42 NS_ASSERTION(aHelper, "Null pointer!");
43 NS_ASSERTION(aHelper->mPersistenceType == quota::PERSISTENCE_TYPE_PERSISTENT,
44 "Checking permission for non persistent databases?!");
47 private:
48 ~CheckPermissionsHelper() {}
50 nsRefPtr<OpenDatabaseHelper> mHelper;
51 nsCOMPtr<nsIDOMWindow> mWindow;
52 bool mPromptAllowed;
53 bool mHasPrompted;
54 uint32_t mPromptResult;
57 END_INDEXEDDB_NAMESPACE
59 #endif // mozilla_dom_indexeddb_checkpermissionshelper_h__