FileSystemDirectoryReader.h (1809B)
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_FileSystemDirectoryReader_h 8 #define mozilla_dom_FileSystemDirectoryReader_h 9 10 #include "mozilla/dom/BindingDeclarations.h" 11 #include "mozilla/dom/FileSystemDirectoryEntry.h" 12 #include "nsCycleCollectionParticipant.h" 13 #include "nsWrapperCache.h" 14 15 namespace mozilla { 16 class ErrorResult; 17 18 namespace dom { 19 20 class Directory; 21 class FileSystem; 22 class FileSystemEntriesCallback; 23 24 class FileSystemDirectoryReader : public nsISupports, public nsWrapperCache { 25 public: 26 NS_DECL_CYCLE_COLLECTING_ISUPPORTS 27 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(FileSystemDirectoryReader) 28 29 explicit FileSystemDirectoryReader(FileSystemDirectoryEntry* aDirectoryEntry, 30 FileSystem* aFileSystem, 31 Directory* aDirectory); 32 33 nsIGlobalObject* GetParentObject() const { 34 return mParentEntry->GetParentObject(); 35 } 36 37 virtual JSObject* WrapObject(JSContext* aCx, 38 JS::Handle<JSObject*> aGivenProto) override; 39 40 virtual void ReadEntries( 41 FileSystemEntriesCallback& aSuccessCallback, 42 const Optional<OwningNonNull<ErrorCallback>>& aErrorCallback, 43 ErrorResult& aRv); 44 45 protected: 46 virtual ~FileSystemDirectoryReader(); 47 48 private: 49 RefPtr<FileSystemDirectoryEntry> mParentEntry; 50 RefPtr<FileSystem> mFileSystem; 51 RefPtr<Directory> mDirectory; 52 53 bool mAlreadyRead; 54 }; 55 56 } // namespace dom 57 } // namespace mozilla 58 59 #endif // mozilla_dom_FileSystemDirectoryReader_h