Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=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_FileSystem_h
8 : #define mozilla_dom_FileSystem_h
9 :
10 : #include "mozilla/Attributes.h"
11 : #include "mozilla/ErrorResult.h"
12 : #include "mozilla/dom/BindingDeclarations.h"
13 : #include "nsCycleCollectionParticipant.h"
14 : #include "nsWrapperCache.h"
15 :
16 : class nsIGlobalObject;
17 :
18 : namespace mozilla {
19 : namespace dom {
20 :
21 : class FileSystemDirectoryEntry;
22 : class FileSystemEntry;
23 : class OwningFileOrDirectory;
24 :
25 : class FileSystem final
26 : : public nsISupports
27 : , public nsWrapperCache
28 : {
29 : public:
30 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
31 0 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileSystem)
32 :
33 : static already_AddRefed<FileSystem>
34 : Create(nsIGlobalObject* aGlobalObject);
35 :
36 : nsIGlobalObject*
37 0 : GetParentObject() const
38 : {
39 0 : return mParent;
40 : }
41 :
42 : virtual JSObject*
43 : WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
44 :
45 : void
46 0 : GetName(nsAString& aName) const
47 : {
48 0 : aName = mName;
49 0 : }
50 :
51 : FileSystemDirectoryEntry*
52 0 : Root() const
53 : {
54 0 : return mRoot;
55 : }
56 :
57 : void
58 : CreateRoot(const Sequence<RefPtr<FileSystemEntry>>& aEntries);
59 :
60 : private:
61 : explicit FileSystem(nsIGlobalObject* aGlobalObject,
62 : const nsAString& aName);
63 : ~FileSystem();
64 :
65 : nsCOMPtr<nsIGlobalObject> mParent;
66 : RefPtr<FileSystemDirectoryEntry> mRoot;
67 : nsString mName;
68 : };
69 :
70 : } // namespace dom
71 : } // namespace mozilla
72 :
73 : #endif // mozilla_dom_FileSystem_h
|