2010-09-09 15:15:40 -07: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 04:12:37 -07: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 15:15:40 -07: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 09:10:56 -07:00
|
|
|
#include "OpenDatabaseHelper.h"
|
2010-09-09 15:15:40 -07:00
|
|
|
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIRunnable.h"
|
|
|
|
|
|
|
|
class nsIDOMWindow;
|
|
|
|
class nsIThread;
|
|
|
|
|
|
|
|
BEGIN_INDEXEDDB_NAMESPACE
|
|
|
|
|
2012-05-14 21:50:29 -07:00
|
|
|
class CheckPermissionsHelper MOZ_FINAL : public nsIRunnable,
|
|
|
|
public nsIInterfaceRequestor,
|
|
|
|
public nsIObserver
|
2010-09-09 15:15:40 -07:00
|
|
|
{
|
|
|
|
public:
|
2013-07-18 19:21:20 -07:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2010-09-09 15:15:40 -07:00
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
2011-10-20 09:10:56 -07:00
|
|
|
CheckPermissionsHelper(OpenDatabaseHelper* aHelper,
|
2010-09-09 15:15:40 -07:00
|
|
|
nsIDOMWindow* aWindow,
|
2011-11-07 16:15:45 -08:00
|
|
|
bool aForDeletion)
|
2010-09-09 15:15:40 -07:00
|
|
|
: mHelper(aHelper),
|
|
|
|
mWindow(aWindow),
|
2011-11-07 16:15:45 -08: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 07:59:28 -07:00
|
|
|
mHasPrompted(false),
|
2010-09-09 15:15:40 -07:00
|
|
|
mPromptResult(0)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(aHelper, "Null pointer!");
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2011-10-20 09:10:56 -07:00
|
|
|
nsRefPtr<OpenDatabaseHelper> mHelper;
|
2010-09-09 15:15:40 -07:00
|
|
|
nsCOMPtr<nsIDOMWindow> mWindow;
|
2011-11-07 16:15:45 -08:00
|
|
|
bool mPromptAllowed;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mHasPrompted;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mPromptResult;
|
2010-09-09 15:15:40 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
END_INDEXEDDB_NAMESPACE
|
|
|
|
|
|
|
|
#endif // mozilla_dom_indexeddb_checkpermissionshelper_h__
|