FileSystem.h (1550B)
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/dom/BindingDeclarations.h" 11 #include "nsCycleCollectionParticipant.h" 12 #include "nsWrapperCache.h" 13 14 class nsIGlobalObject; 15 16 namespace mozilla::dom { 17 18 class FileSystemDirectoryEntry; 19 class FileSystemEntry; 20 class OwningFileOrDirectory; 21 22 class FileSystem final : public nsISupports, public nsWrapperCache { 23 public: 24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 25 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(FileSystem) 26 27 static already_AddRefed<FileSystem> Create(nsIGlobalObject* aGlobalObject); 28 29 nsIGlobalObject* GetParentObject() const { return mParent; } 30 31 virtual JSObject* WrapObject(JSContext* aCx, 32 JS::Handle<JSObject*> aGivenProto) override; 33 34 void GetName(nsAString& aName) const { aName = mName; } 35 36 FileSystemDirectoryEntry* Root() const { return mRoot; } 37 38 void CreateRoot(const Sequence<RefPtr<FileSystemEntry>>& aEntries); 39 40 private: 41 explicit FileSystem(nsIGlobalObject* aGlobalObject, const nsAString& aName); 42 ~FileSystem(); 43 44 nsCOMPtr<nsIGlobalObject> mParent; 45 RefPtr<FileSystemDirectoryEntry> mRoot; 46 nsString mName; 47 }; 48 49 } // namespace mozilla::dom 50 51 #endif // mozilla_dom_FileSystem_h