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

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: Updated extension histograms 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..2bea0be2fa2233a9120330c63d3f43459f49cade 100644
--- a/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc
+++ b/chrome/browser/chromeos/accessibility/switch_access_event_handler.cc
@@ -24,15 +24,17 @@ SwitchAccessEventHandler::~SwitchAccessEventHandler() {
ash::Shell::Get()->RemovePreTargetHandler(this);
}
+void SwitchAccessEventHandler::SetKeysToCapture(
+ const std::vector<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 (std::find(captured_keys_.begin(), captured_keys_.end(), key_code) !=
David Tseng 2017/05/26 22:10:31 Do you care that this will capture as an example,
elichtenberg 2017/05/27 00:13:04 I'm fine with that. I don't see any reason to make
+ captured_keys_.end()) {
CancelEvent(event);
DispatchKeyEventToSwitchAccess(*event);
}

Powered by Google App Engine
This is Rietveld 408576698