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

Unified Diff: ash/magnifier/magnifier_key_scroller.h

Issue 155493002: Add key based scrolling on magnified screen for kiosk mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adressed comments, rebased Created 6 years, 10 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
« no previous file with comments | « ash/magnifier/magnification_controller_unittest.cc ('k') | ash/magnifier/magnifier_key_scroller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/magnifier/magnifier_key_scroller.h
diff --git a/ash/magnifier/magnifier_key_scroller.h b/ash/magnifier/magnifier_key_scroller.h
new file mode 100644
index 0000000000000000000000000000000000000000..4f9f19efb68367a96cbc9147ff1a6947c3611fd3
--- /dev/null
+++ b/ash/magnifier/magnifier_key_scroller.h
@@ -0,0 +1,67 @@
+// 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_MAGNIFIER_MAGNIFIER_KEY_SCROLLER_H_
+#define ASH_MAGNIFIER_MAGNIFIER_KEY_SCROLLER_H_
+
+#include "ash/ash_export.h"
+#include "ui/events/event_handler.h"
+
+namespace ui {
+class KeyEvent;
+}
+
+namespace ash {
+
+// This class implements the press and hold key-bindings (shift-arrow keys)
+// to control magnified screen.
+class ASH_EXPORT MagnifierKeyScroller : public ui::EventHandler {
+ public:
+ static bool IsEnabled();
+ static void SetEnabled(bool enabled);
+
+ MagnifierKeyScroller();
+ virtual ~MagnifierKeyScroller();
+
+ // ui::EventHandler overrides:
+ virtual void OnKeyEvent(ui::KeyEvent* key_event) OVERRIDE;
+
+ // A scoped object to enable and disable the magnifier accelerator for test.
+ class ScopedEnablerForTest {
+ public:
+ ScopedEnablerForTest() {
+ SetEnabled(true);
+ }
+ ~ScopedEnablerForTest() {
+ SetEnabled(false);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedEnablerForTest);
+ };
+
+ private:
+ // A state to keep track of one click and click and hold operation.
+ //
+ // One click:
+ // INITIAL --(first press)--> PRESSED --(release)--> INITIAL[SEND PRESS]
+ //
+ // Click and hold:
+ // INITIAL --(first press)--> PRESSED --(press)-->
+ // HOLD[scroll] --(press)--> HOLD[scroll] --(release)-->
+ // INITIAL[stop scroll]
+ enum State {
+ INITIAL,
+ PRESSED,
+ HOLD
+ };
+
+ State state_;
+
+ DISALLOW_COPY_AND_ASSIGN(MagnifierKeyScroller);
+};
+
+} // namespace ash
+
+#endif // ASH_MAGNIFIER_MAGNIFIER_KEY_SCROLLER_H_
« no previous file with comments | « ash/magnifier/magnification_controller_unittest.cc ('k') | ash/magnifier/magnifier_key_scroller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698