Introduce Mojo interface for accessibility, adding a SetMode() method

Based on, by Colin Blundell <>

This CL starts the process of converting accessibility IPC to Mojo. We
start off by converting the message FrameMsg_SetAccessibilityMode
which, while not strictly a message from accessibility_messages.h,
it's very important in that it's responsible of getting accessibility
enabled in the renderer side, when the ui::AXMode::kWebContent is

Also, it's important to migrate this message first and doing it using
an associated channel for the new mojom::RenderAccessibility interface
since we need to make sure that this new RenderAccessibility::SetMode()
method gets processed in the expected order relative to other messages
already being sent using Mojo between the browser and renderer process,
such as those for mojom::NavigationClient, for instance. Not doing it
in this way would lead to race conditions during the migration period,
since the ordering of some messages from accessibility_messages.h being
migrated to Mojo could not be processed in the expected order compared
to this new RenderAccessibility::SetMode() method, which is required to
happen first to get the RenderAccessibilityImpl object created in the

Specifically, this CL does the following:
- Adds render_accessibility.mojom with the RenderAccessibility
- Adds a new class RenderAccessibilityManager implementing the new
  mojom::RenderAccessibility interface, which will also manage the
  lifecycle of the object that will be handling accessibility in the
  renderer (i.e. the RenderAccessibilityImpl object).
- Sets up the plumbing for RenderFrameHostImpl to be able to connect to
  the mojom::RenderAccessibility implementation via RenderFrameImpl,
  using an associated channel to connect to the receiver side,
  implemented by RenderAccessibilityManager.
- Changes how RenderAccessibilityImpl gets created, so that its
  existence is now manager by RenderAccessibilityManager, which is
  permanently connected to the browser process for the entire lifetime
  of the RenderFrameImpl object.
- Uses this infrastructure to replace the sending and handling of
- Updates RenderFrameImpl::SetAccessibilityModeForTest() to rely on
  RenderAccessibilityManager::SetMode() from now on.
- Updates tests as needed.

Future work will incrementally convert the rest of the accessibility
messages, including introduction of the Mojo interface for methods
that go from the renderer to the browser.

Bug: 1010831
Change-Id: I919177bcf7cfa0af6ae4b921341f239674606d52
Commit-Queue: Mario Sanchez Prada <>
Reviewed-by: Daniel Cheng <>
Reviewed-by: Dominic Mazzoni <>
Reviewed-by: Dave Tapuska <>
Reviewed-by: Arthur Sonzogni <>
Reviewed-by: Kentaro Hara <>
Reviewed-by: Ken Rockot <>
Cr-Commit-Position: refs/heads/master@{#743081}
20 files changed