michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_indexeddb_checkpermissionshelper_h__ michael@0: #define mozilla_dom_indexeddb_checkpermissionshelper_h__ michael@0: michael@0: // Only meant to be included in IndexedDB source files, not exported. michael@0: #include "OpenDatabaseHelper.h" michael@0: michael@0: #include "nsIInterfaceRequestor.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsIRunnable.h" michael@0: michael@0: class nsIDOMWindow; michael@0: class nsIThread; michael@0: michael@0: BEGIN_INDEXEDDB_NAMESPACE michael@0: michael@0: class CheckPermissionsHelper MOZ_FINAL : public nsIRunnable, michael@0: public nsIInterfaceRequestor, michael@0: public nsIObserver michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIRUNNABLE michael@0: NS_DECL_NSIINTERFACEREQUESTOR michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: CheckPermissionsHelper(OpenDatabaseHelper* aHelper, michael@0: nsIDOMWindow* aWindow) michael@0: : mHelper(aHelper), michael@0: mWindow(aWindow), michael@0: // If we're trying to delete the database, we should never prompt the user. michael@0: // Anything that would prompt is translated to denied. michael@0: mPromptAllowed(!aHelper->mForDeletion), michael@0: mHasPrompted(false), michael@0: mPromptResult(0) michael@0: { michael@0: NS_ASSERTION(aHelper, "Null pointer!"); michael@0: NS_ASSERTION(aHelper->mPersistenceType == quota::PERSISTENCE_TYPE_PERSISTENT, michael@0: "Checking permission for non persistent databases?!"); michael@0: } michael@0: michael@0: private: michael@0: nsRefPtr mHelper; michael@0: nsCOMPtr mWindow; michael@0: bool mPromptAllowed; michael@0: bool mHasPrompted; michael@0: uint32_t mPromptResult; michael@0: }; michael@0: michael@0: END_INDEXEDDB_NAMESPACE michael@0: michael@0: #endif // mozilla_dom_indexeddb_checkpermissionshelper_h__