// 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 crosapi.mojom;
import "chromeos/components/drivefs/mojom/drivefs_native_messaging.mojom";
import "mojo/public/mojom/base/file_path.mojom";
// Interface for drive mount point path observers. Implemented by lacros-chrome.
// Used by ash-chrome to send drive availability updates.
[Stable]
interface DriveIntegrationServiceObserver {
// Called when an observed drive availability changes.
[MinVersion=1]
OnMountPointPathChanged@0(mojo_base.mojom.FilePath path);
};
// Interface used to allow ash-chrome to initiate a connection with an extension
// in lacros-chrome. Implemented by lacros-chrome.
[Stable]
interface DriveFsNativeMessageHostBridge {
// Initiates a connection to the extension specified in `params`.
ConnectToExtension@0(
drivefs.mojom.ExtensionConnectionParams params,
pending_receiver<drivefs.mojom.NativeMessagingPort> extension_receiver,
pending_remote<drivefs.mojom.NativeMessagingHost> drivefs_remote) => (
drivefs.mojom.ExtensionConnectionStatus error);
};
// This interface is used to query the DriveIntegrationService for the local
// Google Drive mount associated with the current Ash profile. As well as allows
// clients to subscribe to drive availability updates.
// Implemented by ash-chrome.
//
// Next version: 3
[Stable, Uuid="60fd345d-0f72-4941-a035-910b93c141fa"]
interface DriveIntegrationService {
// Deprecated: Use DriveIntegrationServiceObserver::OnMountPointPathChanged()
// to listen for changes to the DriveFS mount point. These changes are stashed
// in chrome_paths_lacros.cc/h.
DeprecatedGetMountPointPath@0() => (mojo_base.mojom.FilePath drive_path);
// Adds an observer for changes in drive availability. The observer is fired
// immediately with the current mount point path value or empty value in case
// drive is disabled in Ash. Multiple observers may be registered.
[MinVersion=1]
AddDriveIntegrationServiceObserver@1(
pending_remote<DriveIntegrationServiceObserver> observer);
// Called when an extension wants to initiate a connection to DriveFS. Errors
// are returned by resetting `extension_remote`.
[MinVersion=2]
CreateNativeHostSession@2(
drivefs.mojom.ExtensionConnectionParams params,
pending_receiver<drivefs.mojom.NativeMessagingHost> drivefs_receiver,
pending_remote<drivefs.mojom.NativeMessagingPort> extension_remote);
// Registers a bridge that ash-chrome can call into when DriveFS wants to
// initiate a connection to an extension in lacros.
[MinVersion=2]
RegisterDriveFsNativeMessageHostBridge@3(
pending_remote<DriveFsNativeMessageHostBridge> bridge);
};