Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: chrome/browser/chromeos/accessibility/switch_access_event_handler.cc

Issue 2905373002: Set keys for SwitchAccessEventHandler to capture using accessibiltyPrivate API (Closed)
Patch Set: Responded to comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/accessibility/switch_access_event_handler.cc
diff --git a/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc b/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc
index 3f01698a60ad27071b0c58ab43e73e243e17aaf3..0d8344d96991f278cbf5a0c4f38e00c8775b636f 100644
--- a/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc
+++ b/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc
@@ -24,15 +24,16 @@ SwitchAccessEventHandler::~SwitchAccessEventHandler() {
ash::Shell::Get()->RemovePreTargetHandler(this);
}
+void SwitchAccessEventHandler::SetKeysToCapture(
+ const std::unordered_set<int>& key_codes) {
+ captured_keys_ = key_codes;
+}
+
void SwitchAccessEventHandler::OnKeyEvent(ui::KeyEvent* event) {
DCHECK(event);
ui::KeyboardCode key_code = event->key_code();
- if (key_code == ui::VKEY_1 || key_code == ui::VKEY_2 ||
- key_code == ui::VKEY_3 || key_code == ui::VKEY_4 ||
- key_code == ui::VKEY_5 || key_code == ui::VKEY_6 ||
- key_code == ui::VKEY_7 || key_code == ui::VKEY_8 ||
- key_code == ui::VKEY_9) {
+ if (captured_keys_.find(key_code) != captured_keys_.end()) {
CancelEvent(event);
DispatchKeyEventToSwitchAccess(*event);
}

Powered by Google App Engine
This is Rietveld 408576698