2010-09-10 02:15:40 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-09-10 02:15:40 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_dom_indexeddb_checkpermissionshelper_h__
|
|
|
|
#define mozilla_dom_indexeddb_checkpermissionshelper_h__
|
|
|
|
|
|
|
|
// Only meant to be included in IndexedDB source files, not exported.
|
2011-10-20 20:10:56 +04:00
|
|
|
#include "OpenDatabaseHelper.h"
|
2010-09-10 02:15:40 +04:00
|
|
|
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIRunnable.h"
|
|
|
|
|
|
|
|
class nsIDOMWindow;
|
|
|
|
class nsIThread;
|
|
|
|
|
|
|
|
BEGIN_INDEXEDDB_NAMESPACE
|
|
|
|
|
2012-05-15 08:50:29 +04:00
|
|
|
class CheckPermissionsHelper MOZ_FINAL : public nsIRunnable,
|
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public nsIObserver
|
2010-09-10 02:15:40 +04:00
|
|
|
{
|
|
|
|
public:
|
2013-07-19 06:21:20 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2010-09-10 02:15:40 +04:00
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
2011-10-20 20:10:56 +04:00
|
|
|
CheckPermissionsHelper(OpenDatabaseHelper* aHelper,
|
2013-09-11 08:18:36 +04:00
|
|
|
nsIDOMWindow* aWindow)
|
2010-09-10 02:15:40 +04:00
|
|
|
: mHelper(aHelper),
|
|
|
|
mWindow(aWindow),
|
2011-11-08 04:15:45 +04:00
|
|
|
// If we're trying to delete the database, we should never prompt the user.
|
|
|
|
// Anything that would prompt is translated to denied.
|
2013-09-11 08:18:36 +04:00
|
|
|
mPromptAllowed(!aHelper->mForDeletion),
|
2011-10-17 18:59:28 +04:00
|
|
|
mHasPrompted(false),
|
2010-09-10 02:15:40 +04:00
|
|
|
mPromptResult(0)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(aHelper, "Null pointer!");
|
2013-09-11 08:18:36 +04:00
|
|
|
NS_ASSERTION(aHelper->mPersistenceType == quota::PERSISTENCE_TYPE_PERSISTENT,
|
|
|
|
"Checking permission for non persistent databases?!");
|
2010-09-10 02:15:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-10-20 20:10:56 +04:00
|
|
|
nsRefPtr<OpenDatabaseHelper> mHelper;
|
2010-09-10 02:15:40 +04:00
|
|
|
nsCOMPtr<nsIDOMWindow> mWindow;
|
2011-11-08 04:15:45 +04:00
|
|
|
bool mPromptAllowed;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mHasPrompted;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mPromptResult;
|
2010-09-10 02:15:40 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
END_INDEXEDDB_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_indexeddb_checkpermissionshelper_h__
|