Bumping manifests a=b2g-bump
[gecko.git] / dom / filesystem / FileSystemBase.h
blob3b535299948d368e8e1265a94359538e4d5ff5ae
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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/. */
7 #ifndef mozilla_dom_FileSystemBase_h
8 #define mozilla_dom_FileSystemBase_h
10 #include "nsAutoPtr.h"
11 #include "nsString.h"
13 class nsPIDOMWindow;
15 namespace mozilla {
16 namespace dom {
18 class Directory;
19 class FileImpl;
21 class FileSystemBase
23 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileSystemBase)
24 public:
26 // Create file system object from its string representation.
27 static already_AddRefed<FileSystemBase>
28 FromString(const nsAString& aString);
30 FileSystemBase();
32 virtual void
33 Shutdown();
35 // Get the string representation of the file system.
36 const nsString&
37 ToString() const
39 return mString;
42 virtual nsPIDOMWindow*
43 GetWindow() const;
46 * Create nsIFile object with the given real path (absolute DOM path).
48 virtual already_AddRefed<nsIFile>
49 GetLocalFile(const nsAString& aRealPath) const = 0;
52 * Get the virtual name of the root directory. This name will be exposed to
53 * the content page.
55 virtual const nsAString&
56 GetRootName() const = 0;
58 bool
59 IsShutdown() const
61 return mShutdown;
64 virtual bool
65 IsSafeFile(nsIFile* aFile) const;
67 virtual bool
68 IsSafeDirectory(Directory* aDir) const;
71 * Get the real path (absolute DOM path) of the DOM file in the file system.
72 * If succeeded, returns true. Otherwise, returns false and set aRealPath to
73 * empty string.
75 virtual bool
76 GetRealPath(FileImpl* aFile, nsAString& aRealPath) const = 0;
79 * Get the permission name required to access this file system.
81 const nsCString&
82 GetPermission() const
84 return mPermission;
87 bool
88 IsTesting() const
90 return mIsTesting;
92 protected:
93 virtual ~FileSystemBase();
95 // The string representation of the file system.
96 nsString mString;
98 bool mShutdown;
100 // The permission name required to access the file system.
101 nsCString mPermission;
103 bool mIsTesting;
106 } // namespace dom
107 } // namespace mozilla
109 #endif // mozilla_dom_FileSystemBase_h