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 ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ | 5 #ifndef ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ |
6 #define ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ | 6 #define ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/sticky_keys/sticky_keys_state.h" | 9 #include "ash/sticky_keys/sticky_keys_state.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // | 60 // |
61 // StickyKeysController is disabled by default. | 61 // StickyKeysController is disabled by default. |
62 class ASH_EXPORT StickyKeysController : public ui::EventHandler { | 62 class ASH_EXPORT StickyKeysController : public ui::EventHandler { |
63 public: | 63 public: |
64 StickyKeysController(); | 64 StickyKeysController(); |
65 virtual ~StickyKeysController(); | 65 virtual ~StickyKeysController(); |
66 | 66 |
67 // Activate sticky keys to intercept and modify incoming events. | 67 // Activate sticky keys to intercept and modify incoming events. |
68 void Enable(bool enabled); | 68 void Enable(bool enabled); |
69 | 69 |
| 70 void SetModifiersEnabled(bool mod3_enabled, bool altgr_enabled); |
| 71 |
70 // Overridden from ui::EventHandler: | 72 // Overridden from ui::EventHandler: |
71 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 73 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
72 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 74 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
73 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 75 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
74 | 76 |
75 // Returns the StickyKeyOverlay used by the controller. Ownership is not | 77 // Returns the StickyKeyOverlay used by the controller. Ownership is not |
76 // passed. | 78 // passed. |
77 StickyKeysOverlay* GetOverlayForTest(); | 79 StickyKeysOverlay* GetOverlayForTest(); |
78 | 80 |
79 private: | 81 private: |
80 // Handles keyboard event. Returns true if Sticky key consumes keyboard event. | 82 // Handles keyboard event. Returns true if Sticky key consumes keyboard event. |
81 bool HandleKeyEvent(ui::KeyEvent* event); | 83 bool HandleKeyEvent(ui::KeyEvent* event); |
82 | 84 |
83 // Handles mouse event. Returns true if sticky key consumes mouse event. | 85 // Handles mouse event. Returns true if sticky key consumes mouse event. |
84 bool HandleMouseEvent(ui::MouseEvent* event); | 86 bool HandleMouseEvent(ui::MouseEvent* event); |
85 | 87 |
86 // Handles scroll event. Returns true if sticky key consumes scroll event. | 88 // Handles scroll event. Returns true if sticky key consumes scroll event. |
87 bool HandleScrollEvent(ui::ScrollEvent* event); | 89 bool HandleScrollEvent(ui::ScrollEvent* event); |
88 | 90 |
89 // Updates the overlay UI with the current state of the sticky keys. | 91 // Updates the overlay UI with the current state of the sticky keys. |
90 void UpdateOverlay(); | 92 void UpdateOverlay(); |
91 | 93 |
92 // Whether sticky keys is activated and modifying events. | 94 // Whether sticky keys is activated and modifying events. |
93 bool enabled_; | 95 bool enabled_; |
94 | 96 |
| 97 // Whether the current layout has a mod3 key. |
| 98 bool mod3_enabled_; |
| 99 |
| 100 // Whether the current layout has an altgr key. |
| 101 bool altgr_enabled_; |
| 102 |
95 // Sticky key handlers. | 103 // Sticky key handlers. |
96 scoped_ptr<StickyKeysHandler> shift_sticky_key_; | 104 scoped_ptr<StickyKeysHandler> shift_sticky_key_; |
97 scoped_ptr<StickyKeysHandler> alt_sticky_key_; | 105 scoped_ptr<StickyKeysHandler> alt_sticky_key_; |
98 scoped_ptr<StickyKeysHandler> altgr_sticky_key_; | 106 scoped_ptr<StickyKeysHandler> altgr_sticky_key_; |
99 scoped_ptr<StickyKeysHandler> ctrl_sticky_key_; | 107 scoped_ptr<StickyKeysHandler> ctrl_sticky_key_; |
100 | 108 |
101 scoped_ptr<StickyKeysOverlay> overlay_; | 109 scoped_ptr<StickyKeysOverlay> overlay_; |
102 | 110 |
103 DISALLOW_COPY_AND_ASSIGN(StickyKeysController); | 111 DISALLOW_COPY_AND_ASSIGN(StickyKeysController); |
104 }; | 112 }; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 scoped_ptr<ui::KeyEvent> modifier_up_event_; | 238 scoped_ptr<ui::KeyEvent> modifier_up_event_; |
231 | 239 |
232 scoped_ptr<StickyKeysHandlerDelegate> delegate_; | 240 scoped_ptr<StickyKeysHandlerDelegate> delegate_; |
233 | 241 |
234 DISALLOW_COPY_AND_ASSIGN(StickyKeysHandler); | 242 DISALLOW_COPY_AND_ASSIGN(StickyKeysHandler); |
235 }; | 243 }; |
236 | 244 |
237 } // namespace ash | 245 } // namespace ash |
238 | 246 |
239 #endif // ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ | 247 #endif // ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ |
OLD | NEW |