1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/filesystem/DeviceStorageFileSystem.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,70 @@ 1.4 +/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_DeviceStorageFileSystem_h 1.11 +#define mozilla_dom_DeviceStorageFileSystem_h 1.12 + 1.13 +#include "mozilla/dom/FileSystemBase.h" 1.14 +#include "nsString.h" 1.15 + 1.16 +class nsDOMDeviceStorage; 1.17 + 1.18 +namespace mozilla { 1.19 +namespace dom { 1.20 + 1.21 +class DeviceStorageFileSystem 1.22 + : public FileSystemBase 1.23 +{ 1.24 +public: 1.25 + DeviceStorageFileSystem(const nsAString& aStorageType, 1.26 + const nsAString& aStorageName); 1.27 + 1.28 + void 1.29 + Init(nsDOMDeviceStorage* aDeviceStorage); 1.30 + 1.31 + // Overrides FileSystemBase 1.32 + 1.33 + virtual void 1.34 + Shutdown() MOZ_OVERRIDE; 1.35 + 1.36 + virtual nsPIDOMWindow* 1.37 + GetWindow() const MOZ_OVERRIDE; 1.38 + 1.39 + virtual already_AddRefed<nsIFile> 1.40 + GetLocalFile(const nsAString& aRealPath) const MOZ_OVERRIDE; 1.41 + 1.42 + virtual bool 1.43 + GetRealPath(nsIDOMFile* aFile, nsAString& aRealPath) const MOZ_OVERRIDE; 1.44 + 1.45 + virtual const nsAString& 1.46 + GetRootName() const MOZ_OVERRIDE; 1.47 + 1.48 + virtual bool 1.49 + IsSafeFile(nsIFile* aFile) const MOZ_OVERRIDE; 1.50 + 1.51 + virtual bool 1.52 + IsSafeDirectory(Directory* aDir) const MOZ_OVERRIDE; 1.53 +private: 1.54 + virtual 1.55 + ~DeviceStorageFileSystem(); 1.56 + 1.57 + bool 1.58 + LocalPathToRealPath(const nsAString& aLocalPath, nsAString& aRealPath) const; 1.59 + 1.60 + nsString mStorageType; 1.61 + nsString mStorageName; 1.62 + 1.63 + // The local path of the root. Only available in the parent process. 1.64 + // In the child process, we don't use it and its value should be empty. 1.65 + nsString mLocalRootPath; 1.66 + nsString mNormalizedLocalRootPath; 1.67 + nsDOMDeviceStorage* mDeviceStorage; 1.68 +}; 1.69 + 1.70 +} // namespace dom 1.71 +} // namespace mozilla 1.72 + 1.73 +#endif // mozilla_dom_DeviceStorageFileSystem_h