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

Side by Side Diff: ash/sticky_keys/sticky_keys_controller.h

Issue 118543002: Move sticky keys files to their own directory and rename to StickyKeysController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update ash.gyp Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/sticky_keys/OWNERS ('k') | ash/sticky_keys/sticky_keys_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ASH_WM_STICKY_KEYS_H_ 5 #ifndef ASH_WM_STICKY_KEYS_CONTROLLER_H_
6 #define ASH_WM_STICKY_KEYS_H_ 6 #define ASH_WM_STICKY_KEYS_CONTROLLER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
11 #include "ui/events/event_handler.h" 11 #include "ui/events/event_handler.h"
12 12
13 namespace ui { 13 namespace ui {
14 class Event; 14 class Event;
15 class KeyEvent; 15 class KeyEvent;
16 class MouseEvent; 16 class MouseEvent;
17 } // namespace ui 17 } // namespace ui
18 18
19 namespace aura { 19 namespace aura {
20 class Window; 20 class Window;
21 } // namespace aura 21 } // namespace aura
22 22
23 namespace ash { 23 namespace ash {
24 24
25 class StickyKeysHandler; 25 class StickyKeysHandler;
26 26
27 // StickyKeys is an accessibility feature for users to be able to compose key 27 // StickyKeysController is an accessibility feature for users to be able to
28 // and mouse event with modifier keys without simultaneous key press event. 28 // compose key and mouse event with modifier keys without simultaneous key
29 // Instead they can compose events separately pressing each of the modifier 29 // press event. Instead they can compose events separately pressing each of the
30 // keys involved. 30 // modifier keys involved.
31 // e.g. Composing Ctrl + T 31 // e.g. Composing Ctrl + T
32 // User Action : The KeyEvent widget will receives 32 // User Action : The KeyEvent widget will receives
33 // ---------------------------------------------------------- 33 // ----------------------------------------------------------
34 // 1. Press Ctrl key : Ctrl Keydown. 34 // 1. Press Ctrl key : Ctrl Keydown.
35 // 2. Release Ctrl key : No event 35 // 2. Release Ctrl key : No event
36 // 3. Press T key : T keydown event with ctrl modifier. 36 // 3. Press T key : T keydown event with ctrl modifier.
37 // 4. : Ctrl Keyup 37 // 4. : Ctrl Keyup
38 // 5. Release T key : T keyup without ctrl modifier (Windows behavior) 38 // 5. Release T key : T keyup without ctrl modifier (Windows behavior)
39 // 39 //
40 // By typing same modifier keys twice, users can generate bunch of modified key 40 // By typing same modifier keys twice, users can generate bunch of modified key
41 // events. 41 // events.
42 // e.g. To focus tabs consistently by Ctrl + 1, Ctrl + 2 ... 42 // e.g. To focus tabs consistently by Ctrl + 1, Ctrl + 2 ...
43 // User Action : The KeyEvent widget will receives 43 // User Action : The KeyEvent widget will receives
44 // ---------------------------------------------------------- 44 // ----------------------------------------------------------
45 // 1. Press Ctrl key : Ctrl Keydown 45 // 1. Press Ctrl key : Ctrl Keydown
46 // 2. Release Ctrl key : No event 46 // 2. Release Ctrl key : No event
47 // 3. Press Ctrl key : No event 47 // 3. Press Ctrl key : No event
48 // 4. Release Ctrl key : No event 48 // 4. Release Ctrl key : No event
49 // 5. Press 1 key : 1 Keydown event with Ctrl modifier. 49 // 5. Press 1 key : 1 Keydown event with Ctrl modifier.
50 // 6. Release 1 key : 1 Keyup event with Ctrl modifier. 50 // 6. Release 1 key : 1 Keyup event with Ctrl modifier.
51 // 7. Press 2 key : 2 Keydown event with Ctrl modifier. 51 // 7. Press 2 key : 2 Keydown event with Ctrl modifier.
52 // 8. Release 2 key : 2 Keyup event with Ctrl modifier. 52 // 8. Release 2 key : 2 Keyup event with Ctrl modifier.
53 // 9. Press Ctrl key : No event 53 // 9. Press Ctrl key : No event
54 // 10. Release Ctrl key: Ctrl Keyup 54 // 10. Release Ctrl key: Ctrl Keyup
55 // 55 //
56 // In the case of Chrome OS, StickyKeys supports Shift,Alt,Ctrl modifiers. Each 56 // In the case of Chrome OS, StickyKeysController supports Shift,Alt,Ctrl
57 // handling or state is performed independently. 57 // modifiers. Each handling or state is performed independently.
58 // 58 //
59 // StickyKeys is disabled by default. 59 // StickyKeysController is disabled by default.
60 class ASH_EXPORT StickyKeys : public ui::EventHandler { 60 class ASH_EXPORT StickyKeysController : public ui::EventHandler {
61 public: 61 public:
62 StickyKeys(); 62 StickyKeysController();
63 virtual ~StickyKeys(); 63 virtual ~StickyKeysController();
64 64
65 // Activate sticky keys to intercept and modify incoming events. 65 // Activate sticky keys to intercept and modify incoming events.
66 void Enable(bool enabled); 66 void Enable(bool enabled);
67 67
68 private: 68 private:
69 // Handles keyboard event. Returns true if Sticky key consumes keyboard event. 69 // Handles keyboard event. Returns true if Sticky key consumes keyboard event.
70 bool HandleKeyEvent(ui::KeyEvent* event); 70 bool HandleKeyEvent(ui::KeyEvent* event);
71 71
72 // Handles mouse event. Returns true if sticky key consumes mouse event. 72 // Handles mouse event. Returns true if sticky key consumes mouse event.
73 bool HandleMouseEvent(ui::MouseEvent* event); 73 bool HandleMouseEvent(ui::MouseEvent* event);
74 74
75 // Handles scroll event. Returns true if sticky key consumes scroll event. 75 // Handles scroll event. Returns true if sticky key consumes scroll event.
76 bool HandleScrollEvent(ui::ScrollEvent* event); 76 bool HandleScrollEvent(ui::ScrollEvent* event);
77 77
78 // Overridden from ui::EventHandler: 78 // Overridden from ui::EventHandler:
79 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; 79 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
80 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; 80 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
81 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; 81 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
82 82
83 // Whether sticky keys is activated and modifying events. 83 // Whether sticky keys is activated and modifying events.
84 bool enabled_; 84 bool enabled_;
85 85
86 // Sticky key handlers. 86 // Sticky key handlers.
87 scoped_ptr<StickyKeysHandler> shift_sticky_key_; 87 scoped_ptr<StickyKeysHandler> shift_sticky_key_;
88 scoped_ptr<StickyKeysHandler> alt_sticky_key_; 88 scoped_ptr<StickyKeysHandler> alt_sticky_key_;
89 scoped_ptr<StickyKeysHandler> ctrl_sticky_key_; 89 scoped_ptr<StickyKeysHandler> ctrl_sticky_key_;
90 90
91 DISALLOW_COPY_AND_ASSIGN(StickyKeys); 91 DISALLOW_COPY_AND_ASSIGN(StickyKeysController);
92 }; 92 };
93 93
94 // StickyKeysHandler handles key event and performs StickyKeys for specific 94 // StickyKeysHandler handles key event and controls sticky keysfor specific
95 // modifier keys. If monitored keyboard events are recieved, StickyKeysHandler 95 // modifier keys. If monitored keyboard events are recieved, StickyKeysHandler
96 // changes internal state. If non modifier keyboard events or mouse events are 96 // changes internal state. If non modifier keyboard events or mouse events are
97 // received, StickyKeysHandler will append modifier based on internal state. 97 // received, StickyKeysHandler will append modifier based on internal state.
98 // For other events, StickyKeysHandler does nothing. 98 // For other events, StickyKeysHandler does nothing.
99 // 99 //
100 // The DISABLED state is default state and any incoming non modifier keyboard 100 // The DISABLED state is default state and any incoming non modifier keyboard
101 // events will not be modified. The ENABLED state is one shot modification 101 // events will not be modified. The ENABLED state is one shot modification
102 // state. Only next keyboard event will be modified. After that, internal state 102 // state. Only next keyboard event will be modified. After that, internal state
103 // will be back to DISABLED state with sending modifier keyup event. In the case 103 // will be back to DISABLED state with sending modifier keyup event. In the case
104 // of LOCKED state, all incomming keyboard events will be modified. The LOCKED 104 // of LOCKED state, all incomming keyboard events will be modified. The LOCKED
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // The modifier up key event to be sent on non modifier key on ENABLED state. 230 // The modifier up key event to be sent on non modifier key on ENABLED state.
231 scoped_ptr<ui::KeyEvent> modifier_up_event_; 231 scoped_ptr<ui::KeyEvent> modifier_up_event_;
232 232
233 scoped_ptr<StickyKeysHandlerDelegate> delegate_; 233 scoped_ptr<StickyKeysHandlerDelegate> delegate_;
234 234
235 DISALLOW_COPY_AND_ASSIGN(StickyKeysHandler); 235 DISALLOW_COPY_AND_ASSIGN(StickyKeysHandler);
236 }; 236 };
237 237
238 } // namespace ash 238 } // namespace ash
239 239
240 #endif // ASH_WM_STICKY_KEYS_H_ 240 #endif // ASH_WM_STICKY_KEYS_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/sticky_keys/OWNERS ('k') | ash/sticky_keys/sticky_keys_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698