Commit 01a2d8ab authored by David Tseng's avatar David Tseng Committed by Commit Bot

Fixes potential crash when toggling accessibility services

Bug: 887235
Change-Id: Id5aed4e8030ae0d8db02d369bf61772444b441ad
Reviewed-on: https://chromium-review.googlesource.com/c/1286905
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600924}
parent fba6372d
......@@ -35,6 +35,9 @@ void SpokenFeedbackEventRewriterDelegate::DispatchKeyEventToChromeVox(
bool capture) {
extensions::ExtensionHost* host = chromeos::GetAccessibilityExtensionHost(
extension_misc::kChromeVoxExtensionId);
if (!host)
return;
// Listen for any unhandled keyboard events from ChromeVox's background page
// when capturing keys to reinject.
host->host_contents()->SetDelegate(capture ? this : nullptr);
......@@ -47,6 +50,9 @@ void SpokenFeedbackEventRewriterDelegate::DispatchMouseEventToChromeVox(
std::unique_ptr<ui::Event> event) {
extensions::ExtensionHost* host = chromeos::GetAccessibilityExtensionHost(
extension_misc::kChromeVoxExtensionId);
if (!host)
return;
// Forward the event to ChromeVox's background page.
chromeos::ForwardMouseToExtension(*(event->AsMouseEvent()), host);
}
......
......@@ -51,6 +51,9 @@ void SwitchAccessEventHandler::DispatchKeyEventToSwitchAccess(
const ui::KeyEvent& event) {
extensions::ExtensionHost* host =
GetAccessibilityExtensionHost(extension_misc::kSwitchAccessExtensionId);
if (!host)
return;
ForwardKeyToExtension(event, host);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment