OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_EVENTS_KEYBOARD_DRIVEN_EVENT_REWRITER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EVENTS_KEYBOARD_DRIVEN_EVENT_REWRITER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EVENTS_KEYBOARD_DRIVEN_EVENT_REWRITER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EVENTS_KEYBOARD_DRIVEN_EVENT_REWRITER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "ui/events/event_rewriter.h" |
9 | |
10 typedef union _XEvent XEvent; | |
11 | 9 |
12 namespace chromeos { | 10 namespace chromeos { |
13 | 11 |
14 // KeyboardDrivenEventRewriter removes the modifier flags from | 12 // KeyboardDrivenEventRewriter removes the modifier flags from |
15 // Shift+<Arrow keys|Enter|F6> key events. This mapping only happens | 13 // Shift+<Arrow keys|Enter|F6> key events. This mapping only happens |
16 // on login screen and only when the keyboard driven oobe is enabled. | 14 // on login screen and only when the keyboard driven oobe is enabled. |
17 class KeyboardDrivenEventRewriter { | 15 class KeyboardDrivenEventRewriter : public ui::EventRewriter { |
18 public: | 16 public: |
19 KeyboardDrivenEventRewriter(); | 17 KeyboardDrivenEventRewriter(); |
20 ~KeyboardDrivenEventRewriter(); | 18 virtual ~KeyboardDrivenEventRewriter(); |
21 | 19 |
22 // Calls RewriteEvent to modify |event| if it is on login screen and the | 20 // Calls Rewrite for testing. |
23 // keyboard driven flag is enabled. Returns true if the event is changed | 21 ui::EventRewriteStatus RewriteForTesting(const ui::Event& event, |
24 // and no further changes should happen. | 22 scoped_ptr<ui::Event>* new_event); |
25 bool RewriteIfKeyboardDrivenOnLoginScreen(XEvent* event); | |
26 | 23 |
27 // Calls RewriteEvent for testing. | 24 // EventRewriter overrides: |
28 bool RewriteForTesting(XEvent* event); | 25 virtual ui::EventRewriteStatus RewriteEvent( |
| 26 const ui::Event& event, |
| 27 scoped_ptr<ui::Event>* new_event) OVERRIDE; |
| 28 virtual ui::EventRewriteStatus NextDispatchEvent( |
| 29 const ui::Event& last_event, |
| 30 scoped_ptr<ui::Event>* new_event) OVERRIDE; |
29 | 31 |
30 private: | 32 private: |
31 bool RewriteEvent(XEvent* event); | 33 ui::EventRewriteStatus Rewrite(const ui::Event& event, |
| 34 scoped_ptr<ui::Event>* new_event); |
32 | 35 |
33 DISALLOW_COPY_AND_ASSIGN(KeyboardDrivenEventRewriter); | 36 DISALLOW_COPY_AND_ASSIGN(KeyboardDrivenEventRewriter); |
34 }; | 37 }; |
35 | 38 |
36 } // namespace chromeos | 39 } // namespace chromeos |
37 | 40 |
38 #endif // CHROME_BROWSER_CHROMEOS_EVENTS_KEYBOARD_DRIVEN_EVENT_REWRITER_H_ | 41 #endif // CHROME_BROWSER_CHROMEOS_EVENTS_KEYBOARD_DRIVEN_EVENT_REWRITER_H_ |
OLD | NEW |