chromium/services/accessibility/public/mojom/automation_client.mojom

// Copyright 2023 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 "ui/accessibility/mojom/ax_action_data.mojom";
import "ui/accessibility/mojom/ax_tree_id.mojom";

// Implemented outside of the service, e.g. Chrome OS Ash, Chrome browser
// process, renderers, or other tree sources.
// Called by the accessibility service and automation extension API to enable
// accessibility and perform actions. For example the accessibility service
// might want to do a 'click' because a screen reader requested the default
// action. Then the accessibility service would use
// AutomationClient::PerformAction to pass that back to the client.
interface AutomationClient {
  // Enables automation for the client. This will result in the client
  // repeatedly calling DispatchAccessibilityEvents() on the Automation
  // interface.
  // Runs the callback with tree ID for the desktop tree.
  Enable() => (ax.mojom.AXTreeID desktop_id);

  // Disables automation in the client. This has the effect of turning off
  // accessibility tree creation within the client. Calling this method
  // without calling Enable or calling it multiple times has no adverse
  // effects.
  Disable();

  // Enables accessibility for a particular subtree of the client. This will
  // result in the client repeatedly calling DispatchAccessibilityEvents()
  // on the Automation interface.
  // Note that in the old automation API this was called only EnableTree.
  // Renamed here to be clearer which type of tree this is enabling.
  EnableChildTree(ax.mojom.AXTreeID tree_id);

  // Forwards the action described by AXActionData to all clients. Actions
  // are resolved by each client based on tree id, action type and other
  // action data fields.
  PerformAction(ax.mojom.AXActionData action_data);
};