Index: ash/sticky_keys/sticky_keys_controller.h |
diff --git a/ash/sticky_keys/sticky_keys_controller.h b/ash/sticky_keys/sticky_keys_controller.h |
index c31eebd70a8e1ca428a959d885305fb9cc4329e0..37220b03b91fe0079ad5b62501008ce565b7fa4a 100644 |
--- a/ash/sticky_keys/sticky_keys_controller.h |
+++ b/ash/sticky_keys/sticky_keys_controller.h |
@@ -6,6 +6,7 @@ |
#define ASH_STICKY_KEYS_STICKY_KEYS_CONTROLLER_H_ |
#include "ash/ash_export.h" |
+#include "ash/sticky_keys/sticky_keys_constants.h" |
#include "base/memory/scoped_ptr.h" |
#include "ui/events/event_constants.h" |
#include "ui/events/event_handler.h" |
@@ -22,6 +23,7 @@ class Window; |
namespace ash { |
+class StickyKeysOverlay; |
class StickyKeysHandler; |
// StickyKeysController is an accessibility feature for users to be able to |
@@ -65,6 +67,15 @@ class ASH_EXPORT StickyKeysController : public ui::EventHandler { |
// Activate sticky keys to intercept and modify incoming events. |
void Enable(bool enabled); |
+ // Overridden from ui::EventHandler: |
+ virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
+ virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
+ virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
+ |
+ // Returns the StickyKeyOverlay used by the controller. Ownership is not |
+ // passed. |
+ StickyKeysOverlay* GetOverlayForTest(); |
+ |
private: |
// Handles keyboard event. Returns true if Sticky key consumes keyboard event. |
bool HandleKeyEvent(ui::KeyEvent* event); |
@@ -75,10 +86,8 @@ class ASH_EXPORT StickyKeysController : public ui::EventHandler { |
// Handles scroll event. Returns true if sticky key consumes scroll event. |
bool HandleScrollEvent(ui::ScrollEvent* event); |
- // Overridden from ui::EventHandler: |
- virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
- virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
- virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
+ // Updates the overlay UI with the current state of the sticky keys. |
+ void UpdateOverlay(); |
// Whether sticky keys is activated and modifying events. |
bool enabled_; |
@@ -88,6 +97,8 @@ class ASH_EXPORT StickyKeysController : public ui::EventHandler { |
scoped_ptr<StickyKeysHandler> alt_sticky_key_; |
scoped_ptr<StickyKeysHandler> ctrl_sticky_key_; |
+ scoped_ptr<StickyKeysOverlay> overlay_; |
+ |
DISALLOW_COPY_AND_ASSIGN(StickyKeysController); |
}; |
@@ -139,22 +150,9 @@ class ASH_EXPORT StickyKeysHandler { |
virtual void DispatchScrollEvent(ui::ScrollEvent* event, |
aura::Window* target) = 0; |
}; |
- // Represents Sticky Key state. |
- enum StickyKeyState { |
- // The sticky key is disabled. Incomming non modifier key events are not |
- // affected. |
- DISABLED, |
- // The sticky key is enabled. Incomming non modifier key down events are |
- // modified with |modifier_flag_|. After that, sticky key state become |
- // DISABLED. |
- ENABLED, |
- // The sticky key is locked. Incomming non modifier key down events are |
- // modified with |modifier_flag_|. |
- LOCKED, |
- }; |
// This class takes an ownership of |delegate|. |
- StickyKeysHandler(ui::EventFlags modifier_flag, |
+ StickyKeysHandler(StickyKeyModifier modifier, |
StickyKeysHandlerDelegate* delegate); |
~StickyKeysHandler(); |
@@ -207,7 +205,10 @@ class ASH_EXPORT StickyKeysHandler { |
void AppendModifier(ui::MouseEvent* event); |
void AppendModifier(ui::ScrollEvent* event); |
- // The modifier flag to be monitored and appended. |
+ // The modifier key this handler is responsible for. |
+ StickyKeyModifier modifier_; |
+ |
+ // The modifier flag to be monitored and appended to events. |
const ui::EventFlags modifier_flag_; |
// The current sticky key status. |