dom/indexedDB/CheckPermissionsHelper.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

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim: set ts=2 et sw=2 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef mozilla_dom_indexeddb_checkpermissionshelper_h__
michael@0 8 #define mozilla_dom_indexeddb_checkpermissionshelper_h__
michael@0 9
michael@0 10 // Only meant to be included in IndexedDB source files, not exported.
michael@0 11 #include "OpenDatabaseHelper.h"
michael@0 12
michael@0 13 #include "nsIInterfaceRequestor.h"
michael@0 14 #include "nsIObserver.h"
michael@0 15 #include "nsIRunnable.h"
michael@0 16
michael@0 17 class nsIDOMWindow;
michael@0 18 class nsIThread;
michael@0 19
michael@0 20 BEGIN_INDEXEDDB_NAMESPACE
michael@0 21
michael@0 22 class CheckPermissionsHelper MOZ_FINAL : public nsIRunnable,
michael@0 23 public nsIInterfaceRequestor,
michael@0 24 public nsIObserver
michael@0 25 {
michael@0 26 public:
michael@0 27 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 28 NS_DECL_NSIRUNNABLE
michael@0 29 NS_DECL_NSIINTERFACEREQUESTOR
michael@0 30 NS_DECL_NSIOBSERVER
michael@0 31
michael@0 32 CheckPermissionsHelper(OpenDatabaseHelper* aHelper,
michael@0 33 nsIDOMWindow* aWindow)
michael@0 34 : mHelper(aHelper),
michael@0 35 mWindow(aWindow),
michael@0 36 // If we're trying to delete the database, we should never prompt the user.
michael@0 37 // Anything that would prompt is translated to denied.
michael@0 38 mPromptAllowed(!aHelper->mForDeletion),
michael@0 39 mHasPrompted(false),
michael@0 40 mPromptResult(0)
michael@0 41 {
michael@0 42 NS_ASSERTION(aHelper, "Null pointer!");
michael@0 43 NS_ASSERTION(aHelper->mPersistenceType == quota::PERSISTENCE_TYPE_PERSISTENT,
michael@0 44 "Checking permission for non persistent databases?!");
michael@0 45 }
michael@0 46
michael@0 47 private:
michael@0 48 nsRefPtr<OpenDatabaseHelper> mHelper;
michael@0 49 nsCOMPtr<nsIDOMWindow> mWindow;
michael@0 50 bool mPromptAllowed;
michael@0 51 bool mHasPrompted;
michael@0 52 uint32_t mPromptResult;
michael@0 53 };
michael@0 54
michael@0 55 END_INDEXEDDB_NAMESPACE
michael@0 56
michael@0 57 #endif // mozilla_dom_indexeddb_checkpermissionshelper_h__

mercurial