Skip to content

Commit

Permalink
Use an EventRewriter to ensure Select-to-Speak always gets key events.
Browse files Browse the repository at this point in the history
The EventRewriter is able to get events before they are even passed to
the system menus, which allows Select-to-Speak to have a chance to
process key events before the menus can stop key event propagation.

This change basically refactors select_to_speak_event_handler* to
select_to_speak_event_rewriter*. It neither adds nor removes tests.

Bug: 791809,793950
Change-Id: Ied4c937e0ff1bcb2c56121f048d185290f4a168e
Reviewed-on: https://chromium-review.googlesource.com/823280
Commit-Queue: Katie D <katie@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524748}
  • Loading branch information
dektar authored and Commit Bot committed Dec 18, 2017
1 parent 40f1f1b commit 0c0f379
Show file tree
Hide file tree
Showing 9 changed files with 387 additions and 272 deletions.
8 changes: 4 additions & 4 deletions chrome/browser/chromeos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ source_set("chromeos") {
"//components/session_manager/core",
"//components/signin/core/browser",
"//components/ssl_config",
"//components/startup_metric_utils/browser:lib",
"//components/storage_monitor",
"//components/sync_preferences",
"//components/sync_wifi",
"//components/startup_metric_utils/browser:lib",
"//components/toolbar",
"//components/tracing:startup_tracing",
"//components/ukm/content",
Expand Down Expand Up @@ -241,8 +241,8 @@ source_set("chromeos") {
"accessibility/event_handler_common.h",
"accessibility/magnification_manager.cc",
"accessibility/magnification_manager.h",
"accessibility/select_to_speak_event_handler.cc",
"accessibility/select_to_speak_event_handler.h",
"accessibility/select_to_speak_event_rewriter.cc",
"accessibility/select_to_speak_event_rewriter.h",
"accessibility/spoken_feedback_event_rewriter.cc",
"accessibility/spoken_feedback_event_rewriter.h",
"accessibility/switch_access_event_handler.cc",
Expand Down Expand Up @@ -1714,7 +1714,7 @@ source_set("unit_tests") {
"../policy/default_geolocation_policy_handler_unittest.cc",
"../ui/browser_finder_chromeos_unittest.cc",
"accessibility/magnification_manager_unittest.cc",
"accessibility/select_to_speak_event_handler_unittest.cc",
"accessibility/select_to_speak_event_rewriter_unittest.cc",
"accessibility/spoken_feedback_event_rewriter_unittest.cc",
"arc/accessibility/arc_accessibility_helper_bridge_unittest.cc",
"arc/arc_play_store_enabled_preference_handler_unittest.cc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "chrome/browser/chromeos/accessibility/accessibility_extension_loader.h"
#include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager.h"
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "chrome/browser/chromeos/accessibility/select_to_speak_event_handler.h"
#include "chrome/browser/chromeos/accessibility/switch_access_event_handler.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
#include "chrome/browser/chromeos/ash_config.h"
Expand Down Expand Up @@ -969,14 +968,10 @@ void AccessibilityManager::UpdateSelectToSpeakFromPref() {
return;
select_to_speak_enabled_ = enabled;

if (enabled) {
if (enabled)
select_to_speak_loader_->Load(profile_, base::Closure() /* done_cb */);
select_to_speak_event_handler_.reset(
new chromeos::SelectToSpeakEventHandler());
} else {
else
select_to_speak_loader_->Unload();
select_to_speak_event_handler_.reset(nullptr);
}
}

void AccessibilityManager::SetSwitchAccessEnabled(bool enabled) {
Expand Down
4 changes: 0 additions & 4 deletions chrome/browser/chromeos/accessibility/accessibility_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ namespace chromeos {
class AccessibilityExtensionLoader;
class AccessibilityHighlightManager;
class ScopedKeyboardStateSetter;
class SelectToSpeakEventHandler;
class SwitchAccessEventHandler;

enum AccessibilityNotificationType {
Expand Down Expand Up @@ -439,9 +438,6 @@ class AccessibilityManager

std::unique_ptr<AccessibilityExtensionLoader> select_to_speak_loader_;

std::unique_ptr<chromeos::SelectToSpeakEventHandler>
select_to_speak_event_handler_;

std::unique_ptr<AccessibilityExtensionLoader> switch_access_loader_;

std::unique_ptr<chromeos::SwitchAccessEventHandler>
Expand Down
151 changes: 0 additions & 151 deletions chrome/browser/chromeos/accessibility/select_to_speak_event_handler.cc

This file was deleted.

This file was deleted.

Loading

0 comments on commit 0c0f379

Please sign in to comment.