chromium/services/accessibility/public/mojom/automation.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_event.mojom";
import "ui/accessibility/mojom/ax_relative_bounds.mojom";
import "ui/accessibility/mojom/ax_tree_id.mojom";
import "ui/accessibility/mojom/ax_tree_update.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";

// Main interface a client uses to send accessibility tree updates and results,
// implemented in the Accessibility service and Automation extension API.
// Clients may be the main OS browser process, renderers, or other accessibility
// tree sources or aggregators.
interface Automation {
  // Forwards an accessibility tree destroyed event from any accessibility tree
  // from client to the accessibility service.
  DispatchTreeDestroyedEvent(ax.mojom.AXTreeID tree_id);

  // Forwards an action result from any accessibility tree from client ( e.g.
  // Chrome OS Ash, Chrome browser process) to the service. This is sent in
  //response to a call to performAction (in some cases).
  DispatchActionResult(ax.mojom.AXActionData data, bool result);

  // Forwards an event from any accessibility tree to the service.
  DispatchAccessibilityEvents(
    ax.mojom.AXTreeID tree_id,
    array<ax.mojom.AXTreeUpdate> updates,
    gfx.mojom.Point mouse_location,
    array<ax.mojom.AXEvent> events);

  // Dispatches a location change for a specific |node_id| in the tree
  // with ID |tree_id|. Currently used by Blink in
  // RenderAccessibilityHost::HandleAXLocationChanges.
  DispatchAccessibilityLocationChange(
    ax.mojom.AXTreeID tree_id,
    int32 node_id,
    ax.mojom.AXRelativeBounds bounds);

  // Dispatches the result of a query for text location.
  // Currently supported by ARC++ in response to
  // ax::mojom::Action::kGetTextLocation. Rect may not be present if the
  // accessibility node no longer exists.
  [EnableIf=is_chromeos_ash]
  DispatchGetTextLocationResult(
    ax.mojom.AXActionData data,
    gfx.mojom.Rect? rect);
};