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

Unified Diff: ash/sticky_keys/sticky_keys_overlay.h

Issue 137373003: Show overlay displaying the state of all sticky keys when it is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit tests for overlay Created 6 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: ash/sticky_keys/sticky_keys_overlay.h
diff --git a/ash/sticky_keys/sticky_keys_overlay.h b/ash/sticky_keys/sticky_keys_overlay.h
new file mode 100644
index 0000000000000000000000000000000000000000..2cb027f2d692c9f37357e4198efbc1fa464948aa
--- /dev/null
+++ b/ash/sticky_keys/sticky_keys_overlay.h
@@ -0,0 +1,68 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_
+#define ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_
+
+#include "ash/ash_export.h"
+#include "ash/sticky_keys/sticky_keys_constants.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace gfx {
+class Transform;
+}
+
+namespace views {
+class Widget;
+}
+
+namespace ash {
+
+class StickyKeysOverlayView;
+
+// 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.
+// left of the screen that shows the state of every sticky key modifier.
+class ASH_EXPORT StickyKeysOverlay : public ui::LayerAnimationObserver {
+ public:
+ StickyKeysOverlay();
+ virtual ~StickyKeysOverlay();
+
+ // Shows or hides the overlay.
+ void Show(bool visible);
+
+ // Updates the overlay with the current state of a sticky key modifier.
+ void SetModifierKeyState(StickyKeyModifier modifier,
+ StickyKeyState state);
+
+ // Get the current state of the sticky key modifier in the overlay.
+ StickyKeyState GetModifierKeyState(StickyKeyModifier modifier);
+
+ // Returns true if the overlay is currently showing. If the overlay is
+ // animating, the returned value is the target of the animation.
+ 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.
+
+ private:
+ // Returns the current transform of the overlay, based on if it is showing.
+ gfx::Transform CalculateOverlayTransform();
+
+ // gfx::LayerAnimationObserver overrides:
+ virtual void OnLayerAnimationEnded(
+ ui::LayerAnimationSequence* sequence) OVERRIDE;
+ virtual void OnLayerAnimationAborted(
+ ui::LayerAnimationSequence* sequence) OVERRIDE;
+ virtual void OnLayerAnimationScheduled(
+ ui::LayerAnimationSequence* sequence) OVERRIDE;
+
+ bool is_showing_;
+ scoped_ptr<views::Widget> overlay_widget_;
+ gfx::Size widget_size_;
+ // Ownership of |overlay_view_| is passed to the view heirarchy.
+ StickyKeysOverlayView* overlay_view_;
+};
+
+} // ash
James Cook 2014/01/15 22:53:53 "namespace ash"
Tim Song 2014/01/16 00:01:59 Done.
+
+#endif // ASH_STICKY_KEYS_STICKY_KEYS_OVERLAY_H_

Powered by Google App Engine
This is Rietveld 408576698