| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SELECT_TO_SPEAK_EVENT_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SELECT_TO_SPEAK_EVENT_HANDLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SELECT_TO_SPEAK_EVENT_HANDLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SELECT_TO_SPEAK_EVENT_HANDLER_H_ |
| 7 | 7 |
| 8 #include <set> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "ui/events/event_handler.h" | 11 #include "ui/events/event_handler.h" |
| 12 #include "ui/events/keycodes/keyboard_codes.h" |
| 10 | 13 |
| 11 namespace chromeos { | 14 namespace chromeos { |
| 12 | 15 |
| 13 // Intercepts mouse events while the Search key is held down, and sends | 16 // Intercepts mouse events while the Search key is held down, and sends |
| 14 // accessibility events to the Select-to-speak extension instead. | 17 // accessibility events to the Select-to-speak extension instead. |
| 15 class SelectToSpeakEventHandler : public ui::EventHandler { | 18 class SelectToSpeakEventHandler : public ui::EventHandler { |
| 16 public: | 19 public: |
| 17 SelectToSpeakEventHandler(); | 20 SelectToSpeakEventHandler(); |
| 18 ~SelectToSpeakEventHandler() override; | 21 ~SelectToSpeakEventHandler() override; |
| 19 | 22 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 45 MOUSE_RELEASED, | 48 MOUSE_RELEASED, |
| 46 | 49 |
| 47 // The Search key was released while the mouse was still down, cancelling | 50 // The Search key was released while the mouse was still down, cancelling |
| 48 // the Select-to-Speak event. Stay in this mode until the mouse button | 51 // the Select-to-Speak event. Stay in this mode until the mouse button |
| 49 // is released, too. | 52 // is released, too. |
| 50 WAIT_FOR_MOUSE_RELEASE | 53 WAIT_FOR_MOUSE_RELEASE |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 State state_ = INACTIVE; | 56 State state_ = INACTIVE; |
| 54 | 57 |
| 58 // The set of keys that are currently down. Updated whenever a key is |
| 59 // pressed or released. |
| 60 std::set<ui::KeyboardCode> keys_currently_down_; |
| 61 // The set of keys that have been pressed together. Updated whenever a key |
| 62 // is pressed, and only cleared when all keys are released. |
| 63 std::set<ui::KeyboardCode> keys_pressed_together_; |
| 64 |
| 55 int last_view_storage_id_ = 0; | 65 int last_view_storage_id_ = 0; |
| 56 | 66 |
| 57 DISALLOW_COPY_AND_ASSIGN(SelectToSpeakEventHandler); | 67 DISALLOW_COPY_AND_ASSIGN(SelectToSpeakEventHandler); |
| 58 }; | 68 }; |
| 59 | 69 |
| 60 } // namespace chromeos | 70 } // namespace chromeos |
| 61 | 71 |
| 62 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SELECT_TO_SPEAK_EVENT_HANDLER_H
_ | 72 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SELECT_TO_SPEAK_EVENT_HANDLER_H
_ |
| OLD | NEW |