Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 5 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_dom_DeviceStorageFileSystem_h |
michael@0 | 8 | #define mozilla_dom_DeviceStorageFileSystem_h |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/dom/FileSystemBase.h" |
michael@0 | 11 | #include "nsString.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsDOMDeviceStorage; |
michael@0 | 14 | |
michael@0 | 15 | namespace mozilla { |
michael@0 | 16 | namespace dom { |
michael@0 | 17 | |
michael@0 | 18 | class DeviceStorageFileSystem |
michael@0 | 19 | : public FileSystemBase |
michael@0 | 20 | { |
michael@0 | 21 | public: |
michael@0 | 22 | DeviceStorageFileSystem(const nsAString& aStorageType, |
michael@0 | 23 | const nsAString& aStorageName); |
michael@0 | 24 | |
michael@0 | 25 | void |
michael@0 | 26 | Init(nsDOMDeviceStorage* aDeviceStorage); |
michael@0 | 27 | |
michael@0 | 28 | // Overrides FileSystemBase |
michael@0 | 29 | |
michael@0 | 30 | virtual void |
michael@0 | 31 | Shutdown() MOZ_OVERRIDE; |
michael@0 | 32 | |
michael@0 | 33 | virtual nsPIDOMWindow* |
michael@0 | 34 | GetWindow() const MOZ_OVERRIDE; |
michael@0 | 35 | |
michael@0 | 36 | virtual already_AddRefed<nsIFile> |
michael@0 | 37 | GetLocalFile(const nsAString& aRealPath) const MOZ_OVERRIDE; |
michael@0 | 38 | |
michael@0 | 39 | virtual bool |
michael@0 | 40 | GetRealPath(nsIDOMFile* aFile, nsAString& aRealPath) const MOZ_OVERRIDE; |
michael@0 | 41 | |
michael@0 | 42 | virtual const nsAString& |
michael@0 | 43 | GetRootName() const MOZ_OVERRIDE; |
michael@0 | 44 | |
michael@0 | 45 | virtual bool |
michael@0 | 46 | IsSafeFile(nsIFile* aFile) const MOZ_OVERRIDE; |
michael@0 | 47 | |
michael@0 | 48 | virtual bool |
michael@0 | 49 | IsSafeDirectory(Directory* aDir) const MOZ_OVERRIDE; |
michael@0 | 50 | private: |
michael@0 | 51 | virtual |
michael@0 | 52 | ~DeviceStorageFileSystem(); |
michael@0 | 53 | |
michael@0 | 54 | bool |
michael@0 | 55 | LocalPathToRealPath(const nsAString& aLocalPath, nsAString& aRealPath) const; |
michael@0 | 56 | |
michael@0 | 57 | nsString mStorageType; |
michael@0 | 58 | nsString mStorageName; |
michael@0 | 59 | |
michael@0 | 60 | // The local path of the root. Only available in the parent process. |
michael@0 | 61 | // In the child process, we don't use it and its value should be empty. |
michael@0 | 62 | nsString mLocalRootPath; |
michael@0 | 63 | nsString mNormalizedLocalRootPath; |
michael@0 | 64 | nsDOMDeviceStorage* mDeviceStorage; |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | } // namespace dom |
michael@0 | 68 | } // namespace mozilla |
michael@0 | 69 | |
michael@0 | 70 | #endif // mozilla_dom_DeviceStorageFileSystem_h |