2012-05-21 09:18:30 -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/. */
|
|
|
|
|
|
|
|
#ifndef nsDeviceStorage_h
|
|
|
|
#define nsDeviceStorage_h
|
|
|
|
|
|
|
|
class nsPIDOMWindow;
|
|
|
|
|
|
|
|
#include "nsIClassInfo.h"
|
|
|
|
#include "nsIDOMDeviceStorage.h"
|
|
|
|
#include "nsIDOMDeviceStorageCursor.h"
|
|
|
|
#include "nsIDOMWindow.h"
|
|
|
|
#include "nsIURI.h"
|
|
|
|
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsDOMClassInfoID.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsWeakPtr.h"
|
|
|
|
#include "nsInterfaceHashtable.h"
|
|
|
|
|
|
|
|
class nsDOMDeviceStorage : public nsIDOMDeviceStorage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMDEVICESTORAGE
|
|
|
|
|
|
|
|
nsDOMDeviceStorage();
|
|
|
|
|
2012-06-08 21:33:16 -07:00
|
|
|
nsresult Init(nsPIDOMWindow* aWindow, const nsAString &aType, const PRInt32 aIndex);
|
2012-05-21 09:18:30 -07:00
|
|
|
|
|
|
|
PRInt32 SetRootFileForType(const nsAString& aType, const PRInt32 aIndex);
|
|
|
|
|
2012-06-08 21:33:16 -07:00
|
|
|
static void CreateDeviceStoragesFor(nsPIDOMWindow* aWin, const nsAString &aType, nsIVariant** _retval);
|
2012-05-21 09:18:30 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
~nsDOMDeviceStorage();
|
|
|
|
|
|
|
|
|
2012-06-08 21:33:16 -07:00
|
|
|
nsresult GetInternal(const JS::Value & aName, JSContext* aCx, nsIDOMDOMRequest * *_retval NS_OUTPARAM, bool aEditable);
|
|
|
|
nsresult EnumerateInternal(const nsAString & aName, nsIDOMDeviceStorageCursor * *_retval NS_OUTPARAM, bool aEditable);
|
2012-05-21 09:18:30 -07:00
|
|
|
|
|
|
|
PRInt32 mStorageType;
|
|
|
|
nsCOMPtr<nsIFile> mFile;
|
|
|
|
|
|
|
|
nsWeakPtr mOwner;
|
|
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
|
|
|
|
// nsIDOMDeviceStorage.type
|
|
|
|
enum {
|
|
|
|
DEVICE_STORAGE_TYPE_DEFAULT = 0,
|
|
|
|
DEVICE_STORAGE_TYPE_SHARED,
|
|
|
|
DEVICE_STORAGE_TYPE_EXTERNAL,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|