Chromium Code Reviews| Index: chrome/browser/chromeos/accessibility/switch_access_event_handler.h |
| diff --git a/chrome/browser/chromeos/accessibility/switch_access_event_handler.h b/chrome/browser/chromeos/accessibility/switch_access_event_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..87a50f091bd125222a4a01ab684b06e5d3e4dd8a |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/accessibility/switch_access_event_handler.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SWITCH_ACCESS_EVENT_HANDLER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SWITCH_ACCESS_EVENT_HANDLER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "ui/events/event_handler.h" |
| + |
| +namespace chromeos { |
| + |
| +// Intercepts key events. |
|
dmazzoni
2017/02/24 23:06:54
Maybe expand on this a little bit?
When Switch Ac
elichtenberg
2017/02/28 00:28:42
Done.
|
| +class SwitchAccessEventHandler : public ui::EventHandler { |
| + public: |
| + SwitchAccessEventHandler(); |
| + ~SwitchAccessEventHandler() override; |
| + |
| + private: |
| + // EventHandler: |
| + void OnKeyEvent(ui::KeyEvent* event) override; |
| + |
| + void CancelEvent(ui::Event* event); |
| + bool DispatchKeyEventToSwitchAccess(const ui::KeyEvent& event); |
| + |
| + enum State { |
| + // No key from 1 to 5 is pressed. |
| + INACTIVE, |
| + |
| + // The 1 key is down. |
| + ONE_KEY_DOWN, |
| + |
| + // The 2 key is down. |
| + TWO_KEY_DOWN, |
| + |
| + // The 3 key is down. |
| + THREE_KEY_DOWN, |
| + |
| + // The 4 key is down. |
| + FOUR_KEY_DOWN, |
| + |
| + // The 5 key is down. |
| + FIVE_KEY_DOWN, |
| + }; |
| + |
| + State state_ = INACTIVE; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SwitchAccessEventHandler); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SWITCH_ACCESS_EVENT_HANDLER_H_ |