dom/filesystem/DeviceStorageFileSystem.h

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

mercurial