chromium/chrome/services/removable_storage_writer/public/mojom/removable_storage_writer.mojom

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module chrome.mojom;

import "mojo/public/mojom/base/file_path.mojom";
import "sandbox/policy/mojom/sandbox.mojom";

[EnableIf=is_win]
const sandbox.mojom.Sandbox kRemovableStorageWriterSandbox
  = sandbox.mojom.Sandbox.kNoSandboxAndElevatedPrivileges;
[EnableIfNot=is_win]
const sandbox.mojom.Sandbox kRemovableStorageWriterSandbox
  = sandbox.mojom.Sandbox.kNoSandbox;

// Used by the Chromebook Recovery Utility to write bootable images on removable
// storage devices. On Windows requires elevation to access the disk directly.
[ServiceSandbox=kRemovableStorageWriterSandbox]
interface RemovableStorageWriter {
  const string kTestDevice = "chrome://test-removable-storage-writer";

  // Writes the content of the source file to the target. The target file is
  // restricted to removable drives by the utility process.
  Write(mojo_base.mojom.FilePath source,
        mojo_base.mojom.FilePath target,
        pending_remote<RemovableStorageWriterClient> client);

  // Verifies that the contents of the source file was written to the target
  // file. Again, the target is restricted to removable drives by the utility
  // process.
  Verify(mojo_base.mojom.FilePath source,
         mojo_base.mojom.FilePath target,
         pending_remote<RemovableStorageWriterClient> client);
};

interface RemovableStorageWriterClient {
  // Interface to the client used to report write or verify operation progress
  // and completion status.
  Progress(int64 progress);
  Complete(string? error);
};