-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lacros A11y] Send STS context clicks from Lacros to Ash
Select to Speak can now be started from Lacros context menu shown when there is a document selection. This changes adds the crosapi plumbing that sends the context menu click from EmbeddedA11yManagerLacros to AccessibilityManager in Ash. See go/lacros-embedded-a11y-extensions (subsection of larger Lacros a11y doc) for background and design. Note the command line flag to Lacros must be set in ash_browser_test_starter because it needs to be combined with other Lacros flags (rather than being sent separately from the JS test). Since this flag only influences whether an API is available for Select to Speak in Lacros, it seems safe to turn on for all tests. Bug: b/286413297 Test: Manual, new Change-Id: If9ae1ed1a2b7272304fe4de258af0da43369b424 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4711673 Reviewed-by: Yuzhu Shen <yzshen@chromium.org> Reviewed-by: David Tseng <dtseng@chromium.org> Commit-Queue: Katie Dektar <katie@chromium.org> Cr-Commit-Position: refs/heads/main@{#1184779}
- Loading branch information
Katie Dektar
authored and
Chromium LUCI CQ
committed
Aug 17, 2023
1 parent
119b4fa
commit 8b4a740
Showing
16 changed files
with
186 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
chrome/browser/ash/crosapi/embedded_accessibility_helper_client_ash.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// 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. | ||
|
||
#include "chrome/browser/ash/crosapi/embedded_accessibility_helper_client_ash.h" | ||
|
||
#include "chrome/browser/ash/accessibility/accessibility_manager.h" | ||
#include "chromeos/crosapi/mojom/embedded_accessibility_helper.mojom.h" | ||
|
||
namespace crosapi { | ||
|
||
EmbeddedAccessibilityHelperClientAsh::EmbeddedAccessibilityHelperClientAsh() = | ||
default; | ||
EmbeddedAccessibilityHelperClientAsh::~EmbeddedAccessibilityHelperClientAsh() = | ||
default; | ||
|
||
void EmbeddedAccessibilityHelperClientAsh::SpeakSelectedText() { | ||
ash::AccessibilityManager::Get()->OnSelectToSpeakContextMenuClick(); | ||
} | ||
|
||
void EmbeddedAccessibilityHelperClientAsh:: | ||
BindEmbeddedAccessibilityHelperClientFactoryReceiver( | ||
mojo::PendingReceiver< | ||
crosapi::mojom::EmbeddedAccessibilityHelperClientFactory> | ||
receiver) { | ||
embedded_ax_helper_factory_receivers_.Add(this, std::move(receiver)); | ||
} | ||
|
||
void EmbeddedAccessibilityHelperClientAsh:: | ||
BindEmbeddedAccessibilityHelperClient( | ||
mojo::PendingReceiver<crosapi::mojom::EmbeddedAccessibilityHelperClient> | ||
embeded_ax_helper_client) { | ||
embedded_ax_helper_receivers_.Add(this, std::move(embeded_ax_helper_client)); | ||
} | ||
|
||
} // namespace crosapi |
45 changes: 45 additions & 0 deletions
45
chrome/browser/ash/crosapi/embedded_accessibility_helper_client_ash.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// 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. | ||
|
||
#ifndef CHROME_BROWSER_ASH_CROSAPI_EMBEDDED_ACCESSIBILITY_HELPER_CLIENT_ASH_H_ | ||
#define CHROME_BROWSER_ASH_CROSAPI_EMBEDDED_ACCESSIBILITY_HELPER_CLIENT_ASH_H_ | ||
|
||
#include "chromeos/crosapi/mojom/embedded_accessibility_helper.mojom.h" | ||
#include "mojo/public/cpp/bindings/receiver_set.h" | ||
|
||
namespace crosapi { | ||
|
||
class EmbeddedAccessibilityHelperClientAsh | ||
: public crosapi::mojom::EmbeddedAccessibilityHelperClientFactory, | ||
public crosapi::mojom::EmbeddedAccessibilityHelperClient { | ||
public: | ||
EmbeddedAccessibilityHelperClientAsh(); | ||
EmbeddedAccessibilityHelperClientAsh( | ||
const EmbeddedAccessibilityHelperClientAsh&) = delete; | ||
EmbeddedAccessibilityHelperClientAsh& operator=( | ||
const EmbeddedAccessibilityHelperClientAsh&) = delete; | ||
~EmbeddedAccessibilityHelperClientAsh() override; | ||
|
||
// crosapi::mojom::EmbeddedAccessibilityHelperClientFactory: | ||
void BindEmbeddedAccessibilityHelperClient( | ||
mojo::PendingReceiver<crosapi::mojom::EmbeddedAccessibilityHelperClient> | ||
embeded_ax_helper_client) override; | ||
|
||
// crosapi::mojom::EmbeddedAccessibilityHelperClient: | ||
void SpeakSelectedText() override; | ||
|
||
void BindEmbeddedAccessibilityHelperClientFactoryReceiver( | ||
mojo::PendingReceiver< | ||
crosapi::mojom::EmbeddedAccessibilityHelperClientFactory> receiver); | ||
|
||
private: | ||
mojo::ReceiverSet<crosapi::mojom::EmbeddedAccessibilityHelperClientFactory> | ||
embedded_ax_helper_factory_receivers_; | ||
mojo::ReceiverSet<crosapi::mojom::EmbeddedAccessibilityHelperClient> | ||
embedded_ax_helper_receivers_; | ||
}; | ||
|
||
} // namespace crosapi | ||
|
||
#endif // CHROME_BROWSER_ASH_CROSAPI_EMBEDDED_ACCESSIBILITY_HELPER_CLIENT_ASH_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
chromeos/crosapi/mojom/embedded_accessibility_helper.mojom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// 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 crosapi.mojom; | ||
|
||
// Interface for EmbeddedAccessibilityHelperClients. Implemented by ash-chrome. | ||
// Used by lacros-chrome (the "embedded helper") to inform when accessibility | ||
// features have received certain events from lacros-chrome so that | ||
// features can act on these events. | ||
[Stable, Uuid="5d670d98-5c5f-4805-ba83-b77690f5f68c"] | ||
interface EmbeddedAccessibilityHelperClient { | ||
// Called by lacros-chrome when a context menu (added with chrome.contextMenus | ||
// API) is clicked for the Select to Speak feature to request that selected | ||
// text is spoken out loud for the user. This is in place of unsupported | ||
// chrome.contextMenus, which is not piped through for Ash extension APIs to | ||
// act in lacros-chrome. | ||
SpeakSelectedText@0(); | ||
}; | ||
|
||
// A factory living in ash-chrome which brokers connections to other | ||
// processes for EmbeddedAccessibilityHelperClient. | ||
[Stable, Uuid="b6216633-c0d5-4eab-848e-d9fdfeaa3c33"] | ||
interface EmbeddedAccessibilityHelperClientFactory { | ||
// Binds EmbeddedAccessibilityHelperClient's receiver in lacros-chrome. | ||
BindEmbeddedAccessibilityHelperClient@0( | ||
pending_receiver<EmbeddedAccessibilityHelperClient> embedded_ax_helper_client); | ||
}; |
Oops, something went wrong.