chromium/chromeos/ash/services/libassistant/public/mojom/service.mojom

// Copyright 2020 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.libassistant.mojom;

import "chromeos/ash/services/libassistant/public/mojom/audio_input_controller.mojom";
import "chromeos/ash/services/libassistant/public/mojom/audio_output_delegate.mojom";
import "chromeos/ash/services/libassistant/public/mojom/authentication_state_observer.mojom";
import "chromeos/ash/services/libassistant/public/mojom/conversation_controller.mojom";
import "chromeos/ash/services/libassistant/public/mojom/display_controller.mojom";
import "chromeos/ash/services/libassistant/public/mojom/device_settings_delegate.mojom";
import "chromeos/ash/services/libassistant/public/mojom/media_controller.mojom";
import "chromeos/ash/services/libassistant/public/mojom/platform_delegate.mojom";
import "chromeos/ash/services/libassistant/public/mojom/service_controller.mojom";
import "chromeos/ash/services/libassistant/public/mojom/settings_controller.mojom";
import "chromeos/ash/services/libassistant/public/mojom/speaker_id_enrollment_controller.mojom";
import "chromeos/ash/services/libassistant/public/mojom/speech_recognition_observer.mojom";
import "chromeos/ash/services/libassistant/public/mojom/timer_controller.mojom";
import "chromeos/ash/services/libassistant/public/mojom/notification_delegate.mojom";
import "sandbox/policy/mojom/context.mojom";
import "sandbox/policy/mojom/sandbox.mojom";

// Service is hosted in the browser process if libassistant is not available.
[EnableIfNot=enable_cros_libassistant]
const sandbox.mojom.Sandbox kLibassistantServiceSandbox
 = sandbox.mojom.Sandbox.kNoSandbox;
[EnableIf=enable_cros_libassistant]
const sandbox.mojom.Sandbox kLibassistantServiceSandbox
 = sandbox.mojom.Sandbox.kLibassistant;

// The main interface to the Libassistant service on ChromeOS.
// Libassistant provides access to the Google Assistant.
// This will eventually run in a sandboxed process, once we're done migrating
// all Libassistant calls to this service.
// It is used by //chromeos/services/assistant/proxy, which is a trusted
// service running in the browser process.
[ServiceSandbox=kLibassistantServiceSandbox]
interface LibassistantService {

  // Bind everything needed to start the service.
  [AllowedContext=sandbox.mojom.Context.kBrowser]
  Bind(
    pending_receiver<AudioInputController> audio_input_controller,
    pending_receiver<ConversationController> conversation_controller,
    pending_receiver<DisplayController> display_controller,
    pending_receiver<MediaController> media_controller,
    pending_receiver<ServiceController> service_controller,
    pending_receiver<SettingsController> settings_controller,
    pending_receiver<SpeakerIdEnrollmentController> enrollment_controller,
    pending_receiver<TimerController> timer_controller,
    pending_remote<AudioOutputDelegate> audio_output_delegate,
    pending_remote<DeviceSettingsDelegate> device_settings_delegate,
    pending_remote<MediaDelegate> media_delegate,
    pending_remote<NotificationDelegate> delegate,
    pending_remote<PlatformDelegate> platform_delegate,
    pending_remote<TimerDelegate> timer_delegate
  );

  // Add a speech recognition observer, which will be informed of all speech
  // recognition related updates.
  AddSpeechRecognitionObserver(pending_remote<SpeechRecognitionObserver>
    observer);

  // Add an authentication state observer, which will be informed of
  // authentication state changes.
  AddAuthenticationStateObserver(pending_remote<AuthenticationStateObserver>
    observer);
};