FileSystemFileHandle.h (1978B)
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 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef DOM_FS_FILESYSTEMFILEHANDLE_H_ 8 #define DOM_FS_FILESYSTEMFILEHANDLE_H_ 9 10 #include "mozilla/dom/FileSystemHandle.h" 11 12 namespace mozilla { 13 14 class ErrorResult; 15 16 namespace dom { 17 18 struct FileSystemCreateWritableOptions; 19 20 class FileSystemFileHandle final : public FileSystemHandle { 21 public: 22 FileSystemFileHandle(nsIGlobalObject* aGlobal, 23 RefPtr<FileSystemManager>& aManager, 24 const fs::FileSystemEntryMetadata& aMetadata, 25 fs::FileSystemRequestHandler* aRequestHandler); 26 27 FileSystemFileHandle(nsIGlobalObject* aGlobal, 28 RefPtr<FileSystemManager>& aManager, 29 const fs::FileSystemEntryMetadata& aMetadata); 30 31 NS_DECL_ISUPPORTS_INHERITED 32 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemFileHandle, 33 FileSystemHandle) 34 35 // WebIDL Boilerplate 36 JSObject* WrapObject(JSContext* aCx, 37 JS::Handle<JSObject*> aGivenProto) override; 38 39 // WebIDL interface 40 FileSystemHandleKind Kind() const override; 41 42 already_AddRefed<Promise> GetFile(ErrorResult& aError); 43 44 already_AddRefed<Promise> CreateWritable( 45 const FileSystemCreateWritableOptions& aOptions, ErrorResult& aError); 46 47 already_AddRefed<Promise> CreateSyncAccessHandle(ErrorResult& aError); 48 49 // [Serializable] 50 static already_AddRefed<FileSystemFileHandle> ReadStructuredClone( 51 JSContext* aCx, nsIGlobalObject* aGlobal, 52 JSStructuredCloneReader* aReader); 53 54 private: 55 ~FileSystemFileHandle() = default; 56 }; 57 58 } // namespace dom 59 } // namespace mozilla 60 61 #endif // DOM_FS_FILESYSTEMFILEHANDLE_H_