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); |
} |