2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-08-02 10:29:34 +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/. */
|
|
|
|
|
|
|
|
#ifndef DeviceStorage_h
|
|
|
|
#define DeviceStorage_h
|
|
|
|
|
|
|
|
#include "nsIFile.h"
|
2012-07-30 18:58:26 +04:00
|
|
|
#include "nsIPrincipal.h"
|
2012-08-02 10:32:04 +04:00
|
|
|
#include "nsIObserver.h"
|
2014-04-01 10:13:50 +04:00
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
2013-05-11 13:10:18 +04:00
|
|
|
#include "mozilla/RefPtr.h"
|
2013-01-09 19:03:28 +04:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2014-01-17 05:01:27 +04:00
|
|
|
#include "mozilla/dom/DOMRequest.h"
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2013-05-03 03:26:31 +04:00
|
|
|
#define DEVICESTORAGE_PICTURES "pictures"
|
|
|
|
#define DEVICESTORAGE_VIDEOS "videos"
|
|
|
|
#define DEVICESTORAGE_MUSIC "music"
|
|
|
|
#define DEVICESTORAGE_APPS "apps"
|
|
|
|
#define DEVICESTORAGE_SDCARD "sdcard"
|
2013-08-23 18:59:03 +04:00
|
|
|
#define DEVICESTORAGE_CRASHES "crashes"
|
2013-05-03 03:26:31 +04:00
|
|
|
|
2013-09-06 21:50:24 +04:00
|
|
|
class nsIInputStream;
|
2014-06-10 12:51:28 +04:00
|
|
|
class nsIOutputStream;
|
2015-05-29 01:53:16 +03:00
|
|
|
struct DeviceStorageFileDescriptor;
|
2013-09-06 21:50:24 +04:00
|
|
|
|
2013-06-01 10:54:46 +04:00
|
|
|
namespace mozilla {
|
2014-03-17 10:56:53 +04:00
|
|
|
class EventListenerManager;
|
2013-06-01 10:54:46 +04:00
|
|
|
namespace dom {
|
2015-05-12 15:09:51 +03:00
|
|
|
class Blob;
|
2014-06-19 04:57:51 +04:00
|
|
|
struct DeviceStorageEnumerationParameters;
|
2013-06-01 10:56:00 +04:00
|
|
|
class DOMCursor;
|
2013-06-01 10:54:46 +04:00
|
|
|
class DOMRequest;
|
2014-03-05 07:26:39 +04:00
|
|
|
class Promise;
|
2014-03-05 07:25:40 +04:00
|
|
|
class DeviceStorageFileSystem;
|
2013-06-01 10:54:46 +04:00
|
|
|
} // namespace dom
|
2014-01-17 05:01:27 +04:00
|
|
|
namespace ipc {
|
|
|
|
class FileDescriptor;
|
|
|
|
}
|
2013-06-01 10:54:46 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class DeviceStorageFile final
|
2012-12-05 06:00:39 +04:00
|
|
|
: public nsISupports {
|
|
|
|
public:
|
|
|
|
nsCOMPtr<nsIFile> mFile;
|
|
|
|
nsString mStorageType;
|
2013-05-11 13:10:18 +04:00
|
|
|
nsString mStorageName;
|
2013-04-18 18:13:23 +04:00
|
|
|
nsString mRootDir;
|
2013-05-11 13:10:18 +04:00
|
|
|
nsString mPath;
|
2012-12-05 06:00:39 +04:00
|
|
|
bool mEditable;
|
2013-05-17 18:41:53 +04:00
|
|
|
nsString mMimeType;
|
|
|
|
uint64_t mLength;
|
|
|
|
uint64_t mLastModifiedDate;
|
2012-12-05 06:00:39 +04:00
|
|
|
|
2013-04-18 18:13:23 +04:00
|
|
|
// Used when the path will be set later via SetPath.
|
2013-05-11 13:10:18 +04:00
|
|
|
DeviceStorageFile(const nsAString& aStorageType,
|
|
|
|
const nsAString& aStorageName);
|
2013-04-18 18:13:23 +04:00
|
|
|
// Used for non-enumeration purposes.
|
2013-05-11 13:10:18 +04:00
|
|
|
DeviceStorageFile(const nsAString& aStorageType,
|
|
|
|
const nsAString& aStorageName,
|
|
|
|
const nsAString& aPath);
|
2013-08-03 03:35:16 +04:00
|
|
|
// Used for enumerations. When you call Enumerate, you can pass in a
|
|
|
|
// directory to enumerate and the results that are returned are relative to
|
|
|
|
// that directory, files related to an enumeration need to know the "root of
|
|
|
|
// the enumeration" directory.
|
2013-05-11 13:10:18 +04:00
|
|
|
DeviceStorageFile(const nsAString& aStorageType,
|
|
|
|
const nsAString& aStorageName,
|
|
|
|
const nsAString& aRootDir,
|
|
|
|
const nsAString& aPath);
|
2013-04-18 18:13:23 +04:00
|
|
|
|
2012-12-05 06:00:39 +04:00
|
|
|
void SetPath(const nsAString& aPath);
|
|
|
|
void SetEditable(bool aEditable);
|
|
|
|
|
2013-08-03 03:35:16 +04:00
|
|
|
static already_AddRefed<DeviceStorageFile>
|
|
|
|
CreateUnique(nsAString& aFileName,
|
|
|
|
uint32_t aFileType,
|
|
|
|
uint32_t aFileAttributes);
|
2013-05-11 13:10:18 +04:00
|
|
|
|
2013-07-19 06:21:20 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2012-12-05 06:00:39 +04:00
|
|
|
|
2013-05-11 13:10:18 +04:00
|
|
|
bool IsAvailable();
|
2013-08-03 03:34:59 +04:00
|
|
|
void GetFullPath(nsAString& aFullPath);
|
2013-05-11 13:10:18 +04:00
|
|
|
|
2012-12-05 06:00:39 +04:00
|
|
|
// we want to make sure that the names of file can't reach
|
|
|
|
// outside of the type of storage the user asked for.
|
|
|
|
bool IsSafePath();
|
2013-04-18 18:13:23 +04:00
|
|
|
bool IsSafePath(const nsAString& aPath);
|
2012-12-05 06:00:39 +04:00
|
|
|
|
2013-05-11 13:10:18 +04:00
|
|
|
void Dump(const char* label);
|
|
|
|
|
2012-12-05 06:00:39 +04:00
|
|
|
nsresult Remove();
|
|
|
|
nsresult Write(nsIInputStream* aInputStream);
|
|
|
|
nsresult Write(InfallibleTArray<uint8_t>& bits);
|
2014-06-10 12:51:28 +04:00
|
|
|
nsresult Append(nsIInputStream* aInputStream);
|
|
|
|
nsresult Append(nsIInputStream* aInputStream,
|
|
|
|
nsIOutputStream* aOutputStream);
|
2013-05-11 13:10:18 +04:00
|
|
|
void CollectFiles(nsTArray<nsRefPtr<DeviceStorageFile> >& aFiles,
|
|
|
|
PRTime aSince = 0);
|
|
|
|
void collectFilesInternal(nsTArray<nsRefPtr<DeviceStorageFile> >& aFiles,
|
|
|
|
PRTime aSince, nsAString& aRootPath);
|
|
|
|
|
|
|
|
void AccumDiskUsage(uint64_t* aPicturesSoFar, uint64_t* aVideosSoFar,
|
|
|
|
uint64_t* aMusicSoFar, uint64_t* aTotalSoFar);
|
|
|
|
|
2015-06-17 05:30:56 +03:00
|
|
|
void GetStorageFreeSpace(int64_t* aSoFar);
|
2013-05-11 13:10:18 +04:00
|
|
|
void GetStatus(nsAString& aStatus);
|
2014-02-19 06:48:05 +04:00
|
|
|
void GetStorageStatus(nsAString& aStatus);
|
2013-09-06 10:11:58 +04:00
|
|
|
void DoFormat(nsAString& aStatus);
|
2014-03-04 15:24:19 +04:00
|
|
|
void DoMount(nsAString& aStatus);
|
|
|
|
void DoUnmount(nsAString& aStatus);
|
2013-05-11 13:10:18 +04:00
|
|
|
static void GetRootDirectoryForType(const nsAString& aStorageType,
|
|
|
|
const nsAString& aStorageName,
|
2013-04-18 18:13:23 +04:00
|
|
|
nsIFile** aFile);
|
2013-05-17 18:41:53 +04:00
|
|
|
|
|
|
|
nsresult CalculateSizeAndModifiedDate();
|
|
|
|
nsresult CalculateMimeType();
|
2014-01-17 05:01:27 +04:00
|
|
|
nsresult CreateFileDescriptor(mozilla::ipc::FileDescriptor& aFileDescriptor);
|
2013-05-17 18:41:53 +04:00
|
|
|
|
2012-12-05 06:00:39 +04:00
|
|
|
private:
|
2014-07-31 21:05:59 +04:00
|
|
|
~DeviceStorageFile() {}
|
2013-05-11 13:10:18 +04:00
|
|
|
void Init();
|
2012-12-05 06:00:39 +04:00
|
|
|
void NormalizeFilePath();
|
2013-04-18 18:13:23 +04:00
|
|
|
void AppendRelativePath(const nsAString& aPath);
|
2013-05-11 13:10:18 +04:00
|
|
|
void AccumDirectoryUsage(nsIFile* aFile,
|
|
|
|
uint64_t* aPicturesSoFar,
|
|
|
|
uint64_t* aVideosSoFar,
|
|
|
|
uint64_t* aMusicSoFar,
|
|
|
|
uint64_t* aTotalSoFar);
|
2012-12-05 06:00:39 +04:00
|
|
|
};
|
|
|
|
|
2013-02-13 01:16:58 +04:00
|
|
|
/*
|
|
|
|
The FileUpdateDispatcher converts file-watcher-notify
|
|
|
|
observer events to file-watcher-update events. This is
|
|
|
|
used to be able to broadcast events from one child to
|
|
|
|
another child in B2G. (f.e., if one child decides to add
|
|
|
|
a file, we want to be able to able to send a onchange
|
|
|
|
notifications to every other child watching that device
|
|
|
|
storage object).
|
|
|
|
|
|
|
|
We create this object (via GetSingleton) in two places:
|
|
|
|
* ContentParent::Init (for IPC)
|
|
|
|
* nsDOMDeviceStorage::Init (for non-ipc)
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class FileUpdateDispatcher final
|
2013-01-09 19:03:28 +04:00
|
|
|
: public nsIObserver
|
|
|
|
{
|
2014-06-23 23:56:07 +04:00
|
|
|
~FileUpdateDispatcher() {}
|
|
|
|
|
2013-01-09 19:03:28 +04:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
static FileUpdateDispatcher* GetSingleton();
|
|
|
|
private:
|
|
|
|
static mozilla::StaticRefPtr<FileUpdateDispatcher> sSingleton;
|
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsDOMDeviceStorage final
|
2014-04-01 10:13:50 +04:00
|
|
|
: public mozilla::DOMEventTargetHelper
|
2012-08-02 10:32:04 +04:00
|
|
|
, public nsIObserver
|
2012-08-02 10:29:34 +04:00
|
|
|
{
|
2013-06-01 10:54:46 +04:00
|
|
|
typedef mozilla::ErrorResult ErrorResult;
|
2013-06-01 10:56:00 +04:00
|
|
|
typedef mozilla::dom::DeviceStorageEnumerationParameters
|
|
|
|
EnumerationParameters;
|
|
|
|
typedef mozilla::dom::DOMCursor DOMCursor;
|
2013-06-01 10:54:46 +04:00
|
|
|
typedef mozilla::dom::DOMRequest DOMRequest;
|
2014-03-05 07:26:39 +04:00
|
|
|
typedef mozilla::dom::Promise Promise;
|
2014-03-05 07:25:40 +04:00
|
|
|
typedef mozilla::dom::DeviceStorageFileSystem DeviceStorageFileSystem;
|
2012-08-02 10:29:34 +04:00
|
|
|
public:
|
2013-05-11 13:10:18 +04:00
|
|
|
typedef nsTArray<nsString> VolumeNameArray;
|
|
|
|
|
2013-02-07 14:19:08 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-08-02 10:32:04 +04:00
|
|
|
NS_DECL_NSIOBSERVER
|
2015-05-29 01:53:16 +03:00
|
|
|
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
2013-08-03 03:35:16 +04:00
|
|
|
|
2015-05-29 01:53:16 +03:00
|
|
|
void EventListenerWasAdded(const nsAString& aType,
|
|
|
|
ErrorResult& aRv,
|
|
|
|
JSCompartment* aCompartment) override;
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit nsDOMDeviceStorage(nsPIDOMWindow* aWindow);
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2015-03-28 00:22:20 +03:00
|
|
|
static int InstanceCount() { return sInstanceCount; }
|
|
|
|
|
2015-06-17 05:30:56 +03:00
|
|
|
static void InvalidateVolumeCaches();
|
|
|
|
|
2013-05-11 13:10:18 +04:00
|
|
|
nsresult Init(nsPIDOMWindow* aWindow, const nsAString& aType,
|
|
|
|
const nsAString& aVolName);
|
|
|
|
|
|
|
|
bool IsAvailable();
|
2013-08-03 03:35:16 +04:00
|
|
|
bool IsFullPath(const nsAString& aPath)
|
|
|
|
{
|
|
|
|
return aPath.Length() > 0 && aPath.CharAt(0) == '/';
|
|
|
|
}
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2013-08-03 03:35:16 +04:00
|
|
|
void SetRootDirectoryForType(const nsAString& aType,
|
|
|
|
const nsAString& aVolName);
|
2013-04-02 23:52:21 +04:00
|
|
|
|
2013-06-01 10:56:00 +04:00
|
|
|
// WebIDL
|
|
|
|
nsPIDOMWindow*
|
|
|
|
GetParentObject() const
|
|
|
|
{
|
|
|
|
return GetOwner();
|
|
|
|
}
|
|
|
|
virtual JSObject*
|
2015-03-21 19:28:04 +03:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-06-01 10:56:00 +04:00
|
|
|
|
|
|
|
IMPL_EVENT_HANDLER(change)
|
|
|
|
|
|
|
|
already_AddRefed<DOMRequest>
|
2015-05-12 15:09:51 +03:00
|
|
|
Add(mozilla::dom::Blob* aBlob, ErrorResult& aRv);
|
2013-06-01 10:56:00 +04:00
|
|
|
already_AddRefed<DOMRequest>
|
2015-05-12 15:09:51 +03:00
|
|
|
AddNamed(mozilla::dom::Blob* aBlob, const nsAString& aPath, ErrorResult& aRv);
|
2013-06-01 10:56:00 +04:00
|
|
|
|
2014-06-17 11:08:56 +04:00
|
|
|
already_AddRefed<DOMRequest>
|
2015-05-12 15:09:51 +03:00
|
|
|
AppendNamed(mozilla::dom::Blob* aBlob, const nsAString& aPath,
|
|
|
|
ErrorResult& aRv);
|
2014-06-17 11:08:56 +04:00
|
|
|
|
|
|
|
already_AddRefed<DOMRequest>
|
2015-05-12 15:09:51 +03:00
|
|
|
AddOrAppendNamed(mozilla::dom::Blob* aBlob, const nsAString& aPath,
|
2014-06-17 11:08:56 +04:00
|
|
|
const int32_t aRequestType, ErrorResult& aRv);
|
|
|
|
|
2013-06-01 10:56:00 +04:00
|
|
|
already_AddRefed<DOMRequest>
|
|
|
|
Get(const nsAString& aPath, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
return GetInternal(aPath, false, aRv);
|
|
|
|
}
|
|
|
|
already_AddRefed<DOMRequest>
|
|
|
|
GetEditable(const nsAString& aPath, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
return GetInternal(aPath, true, aRv);
|
|
|
|
}
|
|
|
|
already_AddRefed<DOMRequest>
|
|
|
|
Delete(const nsAString& aPath, ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<DOMCursor>
|
|
|
|
Enumerate(const EnumerationParameters& aOptions, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
return Enumerate(NullString(), aOptions, aRv);
|
|
|
|
}
|
|
|
|
already_AddRefed<DOMCursor>
|
|
|
|
Enumerate(const nsAString& aPath, const EnumerationParameters& aOptions,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
already_AddRefed<DOMCursor>
|
|
|
|
EnumerateEditable(const EnumerationParameters& aOptions, ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
return EnumerateEditable(NullString(), aOptions, aRv);
|
|
|
|
}
|
|
|
|
already_AddRefed<DOMCursor>
|
|
|
|
EnumerateEditable(const nsAString& aPath,
|
|
|
|
const EnumerationParameters& aOptions, ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<DOMRequest> FreeSpace(ErrorResult& aRv);
|
|
|
|
already_AddRefed<DOMRequest> UsedSpace(ErrorResult& aRv);
|
|
|
|
already_AddRefed<DOMRequest> Available(ErrorResult& aRv);
|
2013-09-06 10:11:58 +04:00
|
|
|
already_AddRefed<DOMRequest> Format(ErrorResult& aRv);
|
2014-02-19 06:48:05 +04:00
|
|
|
already_AddRefed<DOMRequest> StorageStatus(ErrorResult& aRv);
|
2014-03-04 15:24:19 +04:00
|
|
|
already_AddRefed<DOMRequest> Mount(ErrorResult& aRv);
|
|
|
|
already_AddRefed<DOMRequest> Unmount(ErrorResult& aRv);
|
2013-06-01 10:56:00 +04:00
|
|
|
|
2015-05-29 01:53:16 +03:00
|
|
|
already_AddRefed<DOMRequest> CreateFileDescriptor(const nsAString& aPath,
|
|
|
|
DeviceStorageFileDescriptor* aDSFD,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2014-05-14 02:48:08 +04:00
|
|
|
bool CanBeMounted();
|
|
|
|
bool CanBeFormatted();
|
|
|
|
bool CanBeShared();
|
2014-12-22 05:33:33 +03:00
|
|
|
bool IsRemovable();
|
2013-06-12 20:30:23 +04:00
|
|
|
bool Default();
|
2015-05-29 01:53:16 +03:00
|
|
|
void GetStorageName(nsAString& aStorageName);
|
2013-06-01 10:56:00 +04:00
|
|
|
|
2014-03-05 07:26:39 +04:00
|
|
|
already_AddRefed<Promise>
|
2014-07-19 05:31:11 +04:00
|
|
|
GetRoot(ErrorResult& aRv);
|
2014-03-05 07:26:39 +04:00
|
|
|
|
2013-08-03 03:35:16 +04:00
|
|
|
static void
|
|
|
|
CreateDeviceStorageFor(nsPIDOMWindow* aWin,
|
|
|
|
const nsAString& aType,
|
|
|
|
nsDOMDeviceStorage** aStore);
|
|
|
|
|
|
|
|
static void
|
|
|
|
CreateDeviceStoragesFor(nsPIDOMWindow* aWin,
|
|
|
|
const nsAString& aType,
|
|
|
|
nsTArray<nsRefPtr<nsDOMDeviceStorage> >& aStores);
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2015-05-04 09:11:00 +03:00
|
|
|
static void
|
|
|
|
CreateDeviceStorageByNameAndType(nsPIDOMWindow* aWin,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsAString& aType,
|
|
|
|
nsDOMDeviceStorage** aStore);
|
|
|
|
|
2012-08-02 10:29:34 +04:00
|
|
|
void Shutdown();
|
|
|
|
|
2013-05-11 13:10:18 +04:00
|
|
|
static void GetOrderedVolumeNames(nsTArray<nsString>& aVolumeNames);
|
|
|
|
|
2013-08-03 03:34:59 +04:00
|
|
|
static void GetDefaultStorageName(const nsAString& aStorageType,
|
|
|
|
nsAString &aStorageName);
|
2013-05-11 13:10:18 +04:00
|
|
|
|
2013-08-03 03:34:59 +04:00
|
|
|
static bool ParseFullPath(const nsAString& aFullPath,
|
|
|
|
nsAString& aOutStorageName,
|
|
|
|
nsAString& aOutStoragePath);
|
2012-08-02 10:29:34 +04:00
|
|
|
private:
|
|
|
|
~nsDOMDeviceStorage();
|
|
|
|
|
2013-06-01 10:56:00 +04:00
|
|
|
already_AddRefed<DOMRequest>
|
|
|
|
GetInternal(const nsAString& aPath, bool aEditable, ErrorResult& aRv);
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2013-06-01 10:54:46 +04:00
|
|
|
void
|
|
|
|
GetInternal(nsPIDOMWindow* aWin, const nsAString& aPath, DOMRequest* aRequest,
|
|
|
|
bool aEditable);
|
2013-05-11 13:10:18 +04:00
|
|
|
|
2013-06-01 10:54:46 +04:00
|
|
|
void
|
|
|
|
DeleteInternal(nsPIDOMWindow* aWin, const nsAString& aPath,
|
|
|
|
DOMRequest* aRequest);
|
2013-05-11 13:10:18 +04:00
|
|
|
|
2013-06-01 10:56:00 +04:00
|
|
|
already_AddRefed<DOMCursor>
|
|
|
|
EnumerateInternal(const nsAString& aName,
|
|
|
|
const EnumerationParameters& aOptions, bool aEditable,
|
|
|
|
ErrorResult& aRv);
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2015-03-28 00:22:20 +03:00
|
|
|
static int sInstanceCount;
|
|
|
|
|
2012-08-31 02:17:37 +04:00
|
|
|
nsString mStorageType;
|
|
|
|
nsCOMPtr<nsIFile> mRootDirectory;
|
2013-05-11 13:10:18 +04:00
|
|
|
nsString mStorageName;
|
2014-05-14 02:48:08 +04:00
|
|
|
bool mIsShareable;
|
2014-12-22 05:33:33 +03:00
|
|
|
bool mIsRemovable;
|
2013-08-03 03:34:59 +04:00
|
|
|
|
|
|
|
already_AddRefed<nsDOMDeviceStorage> GetStorage(const nsAString& aFullPath,
|
2013-05-11 13:10:18 +04:00
|
|
|
nsAString& aOutStoragePath);
|
2013-08-03 03:35:16 +04:00
|
|
|
already_AddRefed<nsDOMDeviceStorage>
|
|
|
|
GetStorageByName(const nsAString &aStorageName);
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2015-05-04 09:11:00 +03:00
|
|
|
static already_AddRefed<nsDOMDeviceStorage>
|
|
|
|
GetStorageByNameAndType(nsPIDOMWindow* aWin,
|
|
|
|
const nsAString& aStorageName,
|
|
|
|
const nsAString& aType);
|
|
|
|
|
2012-07-30 18:58:26 +04:00
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
2012-08-02 10:29:34 +04:00
|
|
|
|
2012-08-18 06:43:00 +04:00
|
|
|
bool mIsWatchingFile;
|
2012-08-18 06:43:00 +04:00
|
|
|
bool mAllowedToWatchFile;
|
2015-03-30 05:48:41 +03:00
|
|
|
bool mIsDefaultLocation;
|
|
|
|
void DispatchDefaultChangeEvent();
|
2012-08-18 06:43:00 +04:00
|
|
|
|
2012-08-31 02:17:37 +04:00
|
|
|
nsresult Notify(const char* aReason, class DeviceStorageFile* aFile);
|
2012-08-18 06:43:00 +04:00
|
|
|
|
2012-08-02 10:29:34 +04:00
|
|
|
friend class WatchFileEvent;
|
|
|
|
friend class DeviceStorageRequest;
|
|
|
|
|
2014-04-14 23:04:24 +04:00
|
|
|
static mozilla::StaticAutoPtr<nsTArray<nsString>> sVolumeNameCache;
|
2013-05-11 13:10:18 +04:00
|
|
|
|
2012-08-10 02:41:18 +04:00
|
|
|
#ifdef MOZ_WIDGET_GONK
|
2013-08-23 03:12:25 +04:00
|
|
|
nsString mLastStatus;
|
2014-08-12 07:31:00 +04:00
|
|
|
nsString mLastStorageStatus;
|
2014-07-02 13:35:54 +04:00
|
|
|
void DispatchStatusChangeEvent(nsAString& aStatus);
|
2014-08-12 07:31:00 +04:00
|
|
|
void DispatchStorageStatusChangeEvent(nsAString& aStorageStatus);
|
2012-08-10 02:41:18 +04:00
|
|
|
#endif
|
|
|
|
|
2014-03-05 07:25:40 +04:00
|
|
|
nsRefPtr<DeviceStorageFileSystem> mFileSystem;
|
2012-08-02 10:29:34 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|