chromium/chromeos/crosapi/mojom/volume_manager.mojom

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

module crosapi.mojom;

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

// Volume info for chrome.fileSystem API usage, serving as intermediary from
// file_manager::Volume to file_system::Volume, with additional fields.
[Stable]
struct Volume {
  string volume_id@0;
  string volume_label@1;
  // Equivalent to !is_read_only.
  bool writable@2;
  mojo_base.mojom.FilePath mount_path@3;
  // Whether the volume can be used by lacros-chrome. This is needed because
  // virtual file system support in lacros-chrome is WIP.
  // TODO(crbug.com/1296438): Deprecate once VFS works fully.
  bool is_available_to_lacros@4;
};

// Interface for volume list observers. Implemented by lacros-chrome. Used by
// ash-chrome to send Volume list info and updates.
[Stable, Uuid="ed85b34f-5ccc-41cd-b688-c0601dd629c3"]
interface VolumeListObserver {
  // Called when the volume list changes.
  OnVolumeListChanged@0(array<Volume> volume_list);
};

// Interface with Ash volume manager. Implemented in ash-chrome.
[Stable, Uuid="a5f21bb6-e2f9-4ddf-a01a-f73c09915936"]
interface VolumeManager {
  // Adds an observer for volume list changes.
  AddVolumeListObserver@0(pending_remote<VolumeListObserver> observer);

  // Returns an unfiltered list of volumes.
  GetFullVolumeList@1() => (array<Volume> result);

  // Returns data needed to mount a volume identified by |volume_id|, or empty
  // on error.
  GetVolumeMountInfo@2(string volume_id) => (Volume? result);
};