// 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 ax.mojom;
import "sandbox/policy/mojom/sandbox.mojom";
import "services/accessibility/public/mojom/automation.mojom";
import "services/accessibility/public/mojom/automation_client.mojom";
[EnableIf=supports_os_accessibility_service]
import "services/accessibility/public/mojom/speech_recognition.mojom";
[EnableIf=supports_os_accessibility_service]
import "services/accessibility/public/mojom/tts.mojom";
[EnableIf=supports_os_accessibility_service]
import "third_party/blink/public/mojom/devtools/devtools_agent.mojom";
[EnableIf=supports_os_accessibility_service]
import "services/accessibility/public/mojom/user_input.mojom";
[EnableIf=supports_os_accessibility_service]
import "services/accessibility/public/mojom/user_interface.mojom";
[EnableIf=supports_os_accessibility_service]
import "services/accessibility/public/mojom/assistive_technology_type.mojom";
[EnableIf=supports_os_accessibility_service]
import "services/accessibility/public/mojom/file_loader.mojom";
[EnableIf=supports_os_accessibility_service]
import "services/accessibility/public/mojom/autoclick.mojom";
// Implemented by the accessibility service. Turns on and off features.
// The caller is the client OS, for example, Chrome OS Ash.
[EnableIf=supports_os_accessibility_service]
interface AssistiveTechnologyController {
// Updates the service with the current list of enabled features.
// Any features not in this list are considered disabled.
EnableAssistiveTechnology(array<AssistiveTechnologyType> enabled_features);
};
// AccessibilityService aggregates accessibility information from
// browser, renderer, and other sources, and exposes that information to
// accessibility features. On Chrome OS, the Accessibility Service also
// hosts accessibility features in a V8 runtime.
// TODO(crbug.com/1355633): The Accessibility Service will need to run in a
// sandboxed process that allows V8 execution.
[ServiceSandbox=sandbox.mojom.Sandbox.kService]
interface AccessibilityService {
// Binds a AccessibilityServiceClient implemented in the main OS process to
// the service.
BindAccessibilityServiceClient(
pending_remote<AccessibilityServiceClient> accessibility_service_client);
// Binds an AssistiveTechnologyController implemented in in the service
// process, allowing the client to control which Assistive Technologies are
// active. Callers may pass in a list of initially enabled features; features
// not in this list are assumed disabled.
[EnableIf=supports_os_accessibility_service]
BindAssistiveTechnologyController(
pending_receiver<AssistiveTechnologyController> at_controller,
array<AssistiveTechnologyType> enabled_features);
// Establishes a debugger connection to the specific AT. The remote is held by
// in the browser process by a MojomDevToolsAgentHost. This function is called
// when the agent host is created.
[EnableIf=supports_os_accessibility_service]
ConnectDevToolsAgent(
pending_associated_receiver<blink.mojom.DevToolsAgent> agent,
AssistiveTechnologyType type);
};
// Implemented by the main OS process, e.g. Chrome OS Ash on Chrome OS. Allows
// the AccessibilityService to bind APIs on-demand when needed by AT features,
// and to bind once or once-per-feature. May be called more than once.
// On Chrome OS, for example, when ChromeVox is turned on the service will use
// this interface to bind text-to-speech and Automation APIs, and when Dictation
// is turned on, the service will bind speech recognition and Automation APIs.
// TODO(crbug.com/1355633): Other APIs needed in Chrome OS and Fuchsia should be
// bound here.
interface AccessibilityServiceClient {
// Binds an Automation implemented in the service process, called by
// the main OS browser process.
// In Chrome OS this may be called once per feature to provide
// automation connections to each V8 isolate.
BindAutomation(
pending_associated_remote<Automation> automation);
// Binds to an AutomationClient implemented in the main OS process,
// called by the service.
BindAutomationClient(pending_receiver<AutomationClient> automation_client);
// Binds to a Autoclick client implemented in the main OS process, and
// an Autoclick implemented in the service process, called by the service.
[EnableIf=supports_os_accessibility_service]
BindAutoclickClient(
pending_receiver<AutoclickClient> autoclick_client);
// Binds to a Speech Recognition implementation in the main OS process,
// called by the service.
[EnableIf=supports_os_accessibility_service]
BindSpeechRecognition(pending_receiver<SpeechRecognition> sr_receiver);
// Binds to a Text-to-Speech client implemented in the main OS process,
// called by the service.
[EnableIf=supports_os_accessibility_service]
BindTts(pending_receiver<Tts> tts_receiver);
// Binds to a User Input client implemented in the main OS process,
// called by the service.
[EnableIf=supports_os_accessibility_service]
BindUserInput(pending_receiver<UserInput> user_input_receiver);
// Binds to a User Interface client implemented in the main OS process,
// called by the service.
[EnableIf=supports_os_accessibility_service]
BindUserInterface(pending_receiver<UserInterface> user_interface_receiver);
// Binds to an AccessibilityFileLoader implemented in the main OS process,
// called by the service.
[EnableIf=supports_os_accessibility_service]
BindAccessibilityFileLoader(
pending_receiver<AccessibilityFileLoader> file_loader_receiver);
};