blob: 7a497133fc4e3dc2e46b0010ae8c37cf0c51d47c [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
import "mojo/public/mojom/base/file_info.mojom";
import "third_party/blink/public/mojom/blob/blob.mojom";
import "third_party/blink/public/mojom/blob/serialized_blob.mojom";
import "third_party/blink/public/mojom/file_system_access/file_system_access_error.mojom";
import "third_party/blink/public/mojom/file_system_access/file_system_access_file_writer.mojom";
import "third_party/blink/public/mojom/file_system_access/file_system_access_transfer_token.mojom";
import "third_party/blink/public/mojom/permissions/permission_status.mojom";
// This interface represents a handle to a directory in the File System Access
// API.
interface FileSystemAccessFileHandle {
// Queries the current permission status for this handle.
GetPermissionStatus(bool writable) => (PermissionStatus status);
// Requests read and/or write permission for this handle. Returns the new
// permission status for this handle.
RequestPermission(bool writable) => (FileSystemAccessError result, PermissionStatus status);
// Returns a blob representing the current state of this file.
AsBlob() => (FileSystemAccessError result, mojo_base.mojom.FileInfo info, SerializedBlob? blob);
// Returns a FileWriter object. The FileWriter provides write operations on a file.
CreateFileWriter(bool keep_existing_data, bool auto_close) => (
FileSystemAccessError result, pending_remote<FileSystemAccessFileWriter>? writer);
// Returns true if |other| represents the same file on disk as this handle.
IsSameEntry(pending_remote<FileSystemAccessTransferToken> other) =>
(FileSystemAccessError result, bool is_same);
// Create a TransferToken for this directory. This token can be used to pass
// a reference to this directory to other methods, for example to copy or move
// the file, or when transferring the handle over postMessage.
Transfer(pending_receiver<FileSystemAccessTransferToken> token);
};