// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module ash.secure_channel.mojom;
import "mojo/public/mojom/base/file.mojom";
import "mojo/public/mojom/base/read_only_file.mojom";
// A pair of input and output file created for handling incoming file payload
// transfer from a remote device.
struct PayloadFiles {
// A read-only file that can be used to read from the file payload received.
mojo_base.mojom.ReadOnlyFile input_file;
// A writable file that can be used to store received bytes of the incoming
// file payload.
mojo_base.mojom.File output_file;
};
// The status of the file transfer at the time of this update.
enum FileTransferStatus {
// The transfer has completed successfully.
kSuccess,
// The transfer failed.
kFailure,
// The transfer is still in progress.
kInProgress,
// The transfer has been canceled.
kCanceled,
};
// Describes the status for an active file transfer received from a remote
// device.
struct FileTransferUpdate {
// The ID for the file payload related to this update. The ID is randomly
// generated by the remote device sending the file, and can be negative.
int64 payload_id;
// The status of this file transfer. Always starts with kInProgress and
// ends with one of kSuccess, kFailure or kCanceled.
FileTransferStatus status;
// The total expected bytes of this file transfer.
uint64 total_bytes;
// The number of bytes transferred so far.
uint64 bytes_transferred;
};
// Called with progress information about file transfers.
interface FilePayloadListener {
// Called when a file payload transfer has an update.
OnFileTransferUpdate(FileTransferUpdate update);
};