Re-land: Introduce Mojo interface for accessibility, adding a SetMode() method

Original: r743081 http://crrev.com/c/1991446
Revert: 743086 http://crrev.com/c/2065671

The previously landed CL included changes in RenderAccessibilityImpl
that made more sense in previous iterations of that CL where that class
was not implementing AccessibilityModeChanged(). Those changes forced
us to adapt a few unit tests (accessibility_ipc_error_browsertest.cc,
autofill_browsertest.cc, cross_platform_accessibility_browsertest.cc)
that would otherwise no longer pass.

Unfortunately, it seems that those changes in RenderAccessibilityImpl
broke tests in some platforms (ChromeCast and ChromeOS) so, making the
most of the fact that the final code in RenderAccessibilityImpl is much
closer to the original one than in previous versions, we can drop those
changes and avoid even touching those unit tests we had to adapt before
to fix those build failures, which is what we have added in this CL.

And as a plus, the delta compared to origin/master is much smaller now,
since RenderAccessibilityImpl is now practically unchanged.

Original description:

Based on crrev.com/c/1847304, by Colin Blundell <blundell@chromium.org>

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
specified.

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
renderer.

Specifically, this CL does the following:
- Adds render_accessibility.mojom with the RenderAccessibility
  interface.
- 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
  FrameMsg_SetAccessibilityMode.
- 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.

TBR=dcheng@chromium.org,dtapuska@chromium.org,arthursonzogni@chromium.org,haraken@chromium.org,rockot@google.com

Bug: 1010831
Change-Id: I323c7875a77d05fecf4ae57c61a24fa8268ce463
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2066758
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Mario Sanchez Prada <mario@igalia.com>
Cr-Commit-Position: refs/heads/master@{#743187}
17 files changed