| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_OVERLAY_H_ | 5 #ifndef ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ |
| 6 #define ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ | 6 #define ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 class StickyKeysOverlayView; | 25 class StickyKeysOverlayView; |
| 26 | 26 |
| 27 // Controls the overlay UI for sticky keys, an accessibility feature allowing | 27 // Controls the overlay UI for sticky keys, an accessibility feature allowing |
| 28 // use of modifier keys without holding them down. This overlay will appear as | 28 // use of modifier keys without holding them down. This overlay will appear as |
| 29 // a transparent window on the top left of the screen, showing the state of | 29 // a transparent window on the top left of the screen, showing the state of |
| 30 // each sticky key modifier. | 30 // each sticky key modifier. |
| 31 class ASH_EXPORT StickyKeysOverlay : public ui::LayerAnimationObserver { | 31 class ASH_EXPORT StickyKeysOverlay : public ui::LayerAnimationObserver { |
| 32 public: | 32 public: |
| 33 StickyKeysOverlay(); | 33 StickyKeysOverlay(); |
| 34 virtual ~StickyKeysOverlay(); | 34 ~StickyKeysOverlay() override; |
| 35 | 35 |
| 36 // Shows or hides the overlay. | 36 // Shows or hides the overlay. |
| 37 void Show(bool visible); | 37 void Show(bool visible); |
| 38 | 38 |
| 39 void SetModifierVisible(ui::EventFlags modifier, bool visible); | 39 void SetModifierVisible(ui::EventFlags modifier, bool visible); |
| 40 | 40 |
| 41 bool GetModifierVisible(ui::EventFlags modifier); | 41 bool GetModifierVisible(ui::EventFlags modifier); |
| 42 | 42 |
| 43 // Updates the overlay with the current state of a sticky key modifier. | 43 // Updates the overlay with the current state of a sticky key modifier. |
| 44 void SetModifierKeyState(ui::EventFlags modifier, | 44 void SetModifierKeyState(ui::EventFlags modifier, |
| 45 StickyKeyState state); | 45 StickyKeyState state); |
| 46 | 46 |
| 47 // Get the current state of the sticky key modifier in the overlay. | 47 // Get the current state of the sticky key modifier in the overlay. |
| 48 StickyKeyState GetModifierKeyState(ui::EventFlags modifier); | 48 StickyKeyState GetModifierKeyState(ui::EventFlags modifier); |
| 49 | 49 |
| 50 // Returns true if the overlay is currently visible. If the overlay is | 50 // Returns true if the overlay is currently visible. If the overlay is |
| 51 // animating, the returned value is the target of the animation. | 51 // animating, the returned value is the target of the animation. |
| 52 bool is_visible() { return is_visible_; } | 52 bool is_visible() { return is_visible_; } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 // Returns the current bounds of the overlay, which is based on visibility. | 55 // Returns the current bounds of the overlay, which is based on visibility. |
| 56 gfx::Rect CalculateOverlayBounds(); | 56 gfx::Rect CalculateOverlayBounds(); |
| 57 | 57 |
| 58 // gfx::LayerAnimationObserver overrides: | 58 // gfx::LayerAnimationObserver overrides: |
| 59 virtual void OnLayerAnimationEnded( | 59 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override; |
| 60 ui::LayerAnimationSequence* sequence) override; | 60 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override; |
| 61 virtual void OnLayerAnimationAborted( | 61 void OnLayerAnimationScheduled(ui::LayerAnimationSequence* sequence) override; |
| 62 ui::LayerAnimationSequence* sequence) override; | |
| 63 virtual void OnLayerAnimationScheduled( | |
| 64 ui::LayerAnimationSequence* sequence) override; | |
| 65 | 62 |
| 66 bool is_visible_; | 63 bool is_visible_; |
| 67 scoped_ptr<views::Widget> overlay_widget_; | 64 scoped_ptr<views::Widget> overlay_widget_; |
| 68 // Ownership of |overlay_view_| is passed to the view heirarchy. | 65 // Ownership of |overlay_view_| is passed to the view heirarchy. |
| 69 StickyKeysOverlayView* overlay_view_; | 66 StickyKeysOverlayView* overlay_view_; |
| 70 gfx::Size widget_size_; | 67 gfx::Size widget_size_; |
| 71 }; | 68 }; |
| 72 | 69 |
| 73 } // namespace ash | 70 } // namespace ash |
| 74 | 71 |
| 75 #endif // ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ | 72 #endif // ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ |
| OLD | NEW |