2010-09-09 22:15:40 +00: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 11:12:37 +00: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-09 22:15:40 +00: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 16:10:56 +00:00
|
|
|
#include "OpenDatabaseHelper.h"
|
2010-09-09 22:15:40 +00:00
|
|
|
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIRunnable.h"
|
|
|
|
|
|
|
|
class nsIDOMWindow;
|
|
|
|
class nsIThread;
|
|
|
|
|
|
|
|
BEGIN_INDEXEDDB_NAMESPACE
|
|
|
|
|
2012-05-15 04:50:29 +00:00
|
|
|
class CheckPermissionsHelper MOZ_FINAL : public nsIRunnable,
|
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public nsIObserver
|
2010-09-09 22:15:40 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
2011-10-20 16:10:56 +00:00
|
|
|
CheckPermissionsHelper(OpenDatabaseHelper* aHelper,
|
2010-09-09 22:15:40 +00:00
|
|
|
nsIDOMWindow* aWindow,
|
2011-11-08 00:15:45 +00:00
|
|
|
bool aForDeletion)
|
2010-09-09 22:15:40 +00:00
|
|
|
: mHelper(aHelper),
|
|
|
|
mWindow(aWindow),
|
2011-11-08 00:15:45 +00:00
|
|
|
// If we're trying to delete the database, we should never prompt the user.
|
|
|
|
// Anything that would prompt is translated to denied.
|
|
|
|
mPromptAllowed(!aForDeletion),
|
2011-10-17 14:59:28 +00:00
|
|
|
mHasPrompted(false),
|
2010-09-09 22:15:40 +00:00
|
|
|
mPromptResult(0)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(aHelper, "Null pointer!");
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-10-20 16:10:56 +00:00
|
|
|
nsRefPtr<OpenDatabaseHelper> mHelper;
|
2010-09-09 22:15:40 +00:00
|
|
|
nsCOMPtr<nsIDOMWindow> mWindow;
|
2011-11-08 00:15:45 +00:00
|
|
|
bool mPromptAllowed;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mHasPrompted;
|
2010-09-09 22:15:40 +00:00
|
|
|
PRUint32 mPromptResult;
|
|
|
|
};
|
|
|
|
|
|
|
|
END_INDEXEDDB_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_indexeddb_checkpermissionshelper_h__
|