2022-01-24 15:11:29 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef DOM_FS_FILESYSTEMFILEHANDLE_H_
|
|
|
|
#define DOM_FS_FILESYSTEMFILEHANDLE_H_
|
|
|
|
|
|
|
|
#include "mozilla/dom/FileSystemHandle.h"
|
|
|
|
|
2022-05-02 10:44:23 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
|
|
|
namespace dom {
|
2022-01-24 15:11:29 +03:00
|
|
|
|
|
|
|
struct FileSystemCreateWritableOptions;
|
|
|
|
|
|
|
|
class FileSystemFileHandle final : public FileSystemHandle {
|
|
|
|
public:
|
2022-06-28 19:04:17 +03:00
|
|
|
FileSystemFileHandle(nsIGlobalObject* aGlobal,
|
2022-08-31 12:34:52 +03:00
|
|
|
RefPtr<FileSystemManager>& aManager,
|
2022-06-28 19:04:17 +03:00
|
|
|
const fs::FileSystemEntryMetadata& aMetadata,
|
|
|
|
fs::FileSystemRequestHandler* aRequestHandler);
|
|
|
|
|
|
|
|
FileSystemFileHandle(nsIGlobalObject* aGlobal,
|
2022-08-31 12:34:52 +03:00
|
|
|
RefPtr<FileSystemManager>& aManager,
|
2022-06-28 19:04:17 +03:00
|
|
|
const fs::FileSystemEntryMetadata& aMetadata);
|
|
|
|
|
2022-01-24 15:11:29 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FileSystemFileHandle,
|
|
|
|
FileSystemHandle)
|
|
|
|
|
|
|
|
// WebIDL Boilerplate
|
|
|
|
JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
|
|
|
// WebIDL interface
|
2022-06-28 19:04:17 +03:00
|
|
|
FileSystemHandleKind Kind() const override;
|
2022-01-24 15:11:29 +03:00
|
|
|
|
2022-05-02 10:44:23 +03:00
|
|
|
already_AddRefed<Promise> GetFile(ErrorResult& aError);
|
2022-01-24 15:11:29 +03:00
|
|
|
|
|
|
|
already_AddRefed<Promise> CreateWritable(
|
2022-05-02 10:44:23 +03:00
|
|
|
const FileSystemCreateWritableOptions& aOptions, ErrorResult& aError);
|
2022-01-24 15:11:29 +03:00
|
|
|
|
2022-05-02 10:44:23 +03:00
|
|
|
already_AddRefed<Promise> CreateSyncAccessHandle(ErrorResult& aError);
|
2022-01-24 18:48:46 +03:00
|
|
|
|
2022-09-07 04:14:53 +03:00
|
|
|
// [Serializable]
|
|
|
|
static already_AddRefed<FileSystemFileHandle> ReadStructuredClone(
|
|
|
|
JSContext* aCx, nsIGlobalObject* aGlobal,
|
|
|
|
JSStructuredCloneReader* aReader);
|
|
|
|
|
2022-01-24 15:11:29 +03:00
|
|
|
private:
|
|
|
|
~FileSystemFileHandle() = default;
|
|
|
|
};
|
|
|
|
|
2022-05-02 10:44:23 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2022-01-24 15:11:29 +03:00
|
|
|
|
|
|
|
#endif // DOM_FS_FILESYSTEMFILEHANDLE_H_
|