Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ | |
| 6 #define ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "ash/sticky_keys/sticky_keys_constants.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/compositor/layer_animation_observer.h" | |
| 12 #include "ui/gfx/geometry/size.h" | |
| 13 | |
| 14 namespace gfx { | |
| 15 class Transform; | |
| 16 } | |
| 17 | |
| 18 namespace views { | |
| 19 class Widget; | |
| 20 } | |
| 21 | |
| 22 namespace ash { | |
| 23 | |
| 24 class StickyKeysOverlayView; | |
| 25 | |
| 26 // Controls the overlay UI for sticky keys, a transparent overlay at the top | |
|
James Cook
2014/01/15 22:53:53
nit: Might mention the word "accessibility" in thi
Tim Song
2014/01/16 00:01:59
Done.
| |
| 27 // left of the screen that shows the state of every sticky key modifier. | |
| 28 class ASH_EXPORT StickyKeysOverlay : public ui::LayerAnimationObserver { | |
| 29 public: | |
| 30 StickyKeysOverlay(); | |
| 31 virtual ~StickyKeysOverlay(); | |
| 32 | |
| 33 // Shows or hides the overlay. | |
| 34 void Show(bool visible); | |
| 35 | |
| 36 // Updates the overlay with the current state of a sticky key modifier. | |
| 37 void SetModifierKeyState(StickyKeyModifier modifier, | |
| 38 StickyKeyState state); | |
| 39 | |
| 40 // Get the current state of the sticky key modifier in the overlay. | |
| 41 StickyKeyState GetModifierKeyState(StickyKeyModifier modifier); | |
| 42 | |
| 43 // Returns true if the overlay is currently showing. If the overlay is | |
| 44 // animating, the returned value is the target of the animation. | |
| 45 bool is_showing() { return is_showing_; } | |
|
James Cook
2014/01/15 22:53:53
optional: Would this be better as is_visible()? I
Tim Song
2014/01/16 00:01:59
Done.
| |
| 46 | |
| 47 private: | |
| 48 // Returns the current transform of the overlay, based on if it is showing. | |
| 49 gfx::Transform CalculateOverlayTransform(); | |
| 50 | |
| 51 // gfx::LayerAnimationObserver overrides: | |
| 52 virtual void OnLayerAnimationEnded( | |
| 53 ui::LayerAnimationSequence* sequence) OVERRIDE; | |
| 54 virtual void OnLayerAnimationAborted( | |
| 55 ui::LayerAnimationSequence* sequence) OVERRIDE; | |
| 56 virtual void OnLayerAnimationScheduled( | |
| 57 ui::LayerAnimationSequence* sequence) OVERRIDE; | |
| 58 | |
| 59 bool is_showing_; | |
| 60 scoped_ptr<views::Widget> overlay_widget_; | |
| 61 gfx::Size widget_size_; | |
| 62 // Ownership of |overlay_view_| is passed to the view heirarchy. | |
| 63 StickyKeysOverlayView* overlay_view_; | |
| 64 }; | |
| 65 | |
| 66 } // ash | |
|
James Cook
2014/01/15 22:53:53
"namespace ash"
Tim Song
2014/01/16 00:01:59
Done.
| |
| 67 | |
| 68 #endif // ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_ | |
| OLD | NEW |