summaryrefslogtreecommitdiff
path: root/chromium/content/common/render_accessibility.mojom
blob: 19ec49f79f4ab4ca621d7d7e7f36c594100ba8a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module content.mojom;

import "content/common/ax_content_tree_update.mojom";
import "ui/accessibility/ax_enums.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/gfx/geometry/mojom/geometry.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";

struct LocationChanges {
  // ID of the object whose location is changing.
  int32 id;

  // The object's new location info.
  ax.mojom.AXRelativeBounds new_location;
};

struct HitTestResponse {
  // The frame token of the frame that got hit. If this is not equal to the
  // frame that the original hit test was called on, the client should do
  // another hit test on this frame.
  mojo_base.mojom.UnguessableToken hit_frame_token;

  // The coordinates that should be used for the hit test on the child frame
  // indicated by |hit_frame_token|, accounting for the viewport. This is only
  // needed if |hit_frame_token| is not the same as the current frame's token.
  gfx.mojom.Point hit_frame_transformed_point;

  // The AXID of the accessibility node that got hit.
  int32 hit_node_id;
};

// Interface for accessibility messages sent from the renderer to the browser,
// implemented by RenderFrameHostImpl in the browser process.
interface RenderAccessibilityHost {
  // Sent to notify the browser about renderer accessibility events.
  //
  // The browser will respond by invoking the callback specified by the renderer
  // as part of once the original call has been processed, in order to notify
  // the renderer that it can send additional updates.
  //
  // |reset_token| parameter is set if this method was sent in response to a
  // reset request from the browser. When the browser requests a reset, it
  // ignores incoming remote calls until it sees one with the correct reset
  // token. Any other time, it ignores further calls with a reset token.
  HandleAXEvents(array<ax.mojom.AXContentTreeUpdate> updates,
                 array<ax.mojom.AXEvent> events, int32 reset_token) => ();

  // Sent to update the browser of the location of accessibility objects.
  HandleAXLocationChanges(array<LocationChanges> changes);
};

// Interface for accessibility messages sent from RenderFrameHostImpl in the
// browser process, implemented by the RenderAccessibilityManager object in the
// renderer process. This RenderAccessibilityManager object will be owned by the
// RenderFrameImpl object, which will keep it alive during its entire lifetime.
//
// This interface is used via an associated channel from RenderFrameHostImpl in
// the browser process, shared with other interfaces that accessibility-related
// messages need to maintain the order with like NavigationClient or LocalFrame.
interface RenderAccessibility {
  // Change the accessibility mode in the renderer process for a given frame to
  // match the one set for such frame from the browser process. |ax_mode| should
  // contain at least the ui::AXMode::kWebContents value to enable accessibility
  // support for web contents. See ui/accessibility/ax_mode.h for valid values.
  SetMode(uint32 ax_mode);

  // Kills the renderer. Sent when there is a fatal error in the accessibility
  // tree and the maximum number of resets has been hit.
  FatalError();

  // Relays a request from assistive technology to perform a hit test over the
  // accessibility object at the point passed via |point| in frame pixels.
  //
  // If the object hit doesn't have a child frame, and if |event_to_fire| is
  // set, the accessibility event will be emitted on the hit node with the
  // given request ID.
  //
  // Either way, the response contains the routing ID of the hit frame,
  // and the transformed point if the hit frame is a child frame.
  HitTest(gfx.mojom.Point point,
          ax.mojom.Event event_to_fire,
          int32 request_id)
      => (HitTestResponse? hit_test_response);

  // Relay a request from assistive technology to perform an action, such as
  // focusing or clicking on a node.
  PerformAction(ax.mojom.AXActionData action_data);

  // Tell the renderer to reset and send a new accessibility tree from scratch
  // because the browser is out of sync. It passes a sequential reset token.
  // This should be rare, and if we need to reset the same renderer too many
  // times we just kill it. After sending a reset, the browser ignores incoming
  // accessibility IPCs until it receives one with the matching reset token.
  // Conversely, it ignores IPCs with a reset token if it was not expecting a
  // reset.
  Reset(int32 reset_token);
};