blob: 5f8b2f58cb3ec05f96d986f1e130feba05054183 [file] [log] [blame]
// 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 "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/accessibility/mojom/ax_tree_update.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.
//
// The accessibility information sent to the browser is dependent on both
// the number of nodes in the DOM (and their accessibility metadata) as well
// as the number of changes that generate events. Therefore, this payload can
// become arbitrarily large.
// TODO(crbug.com/1088484) tracks work to improve the payload size.
[UnlimitedSize]
HandleAXEvents(array<ax.mojom.AXTreeUpdate> updates,
array<ax.mojom.AXEvent> events, int32 reset_token) => ();
// Sent to update the browser of the location of accessibility objects.
// Similar to HandleAXEvents, the message size is also unbounded (though in
// practice these message sizes are quite a bit smaller than HandleAXEvents).
// TODO(crbug.com/1088484) tracks work to improve the payload size.
[UnlimitedSize]
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);
};