Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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
25 {
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)
41 {
42 NS_ASSERTION(aHelper, "Null pointer!");
43 NS_ASSERTION(aHelper->mPersistenceType == quota::PERSISTENCE_TYPE_PERSISTENT,
44 "Checking permission for non persistent databases?!");
45 }
47 private:
48 nsRefPtr<OpenDatabaseHelper> mHelper;
49 nsCOMPtr<nsIDOMWindow> mWindow;
50 bool mPromptAllowed;
51 bool mHasPrompted;
52 uint32_t mPromptResult;
53 };
55 END_INDEXEDDB_NAMESPACE
57 #endif // mozilla_dom_indexeddb_checkpermissionshelper_h__