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

Unified Diff: ash/magnifier/magnifier_key_scroller.h

Issue 164823005: Long press menu (shift+f6) to toggle spoken feedback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: ash/magnifier/magnifier_key_scroller.h
diff --git a/ash/magnifier/magnifier_key_scroller.h b/ash/magnifier/magnifier_key_scroller.h
index 4f9f19efb68367a96cbc9147ff1a6947c3611fd3..173d6249f2f647b7b77936134fcea71c108a6c7e 100644
--- a/ash/magnifier/magnifier_key_scroller.h
+++ b/ash/magnifier/magnifier_key_scroller.h
@@ -5,6 +5,7 @@
#ifndef ASH_MAGNIFIER_MAGNIFIER_KEY_SCROLLER_H_
#define ASH_MAGNIFIER_MAGNIFIER_KEY_SCROLLER_H_
+#include "ash/accelerators/key_hold_detector.h"
#include "ash/ash_export.h"
#include "ui/events/event_handler.h"
@@ -14,18 +15,12 @@ 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 {
+// A KeyHoldDetector delegate to control control magnified screen.
+class ASH_EXPORT MagnifierKeyScroller : public KeyHoldDetector::Delegate {
public:
static bool IsEnabled();
static void SetEnabled(bool enabled);
-
- MagnifierKeyScroller();
- virtual ~MagnifierKeyScroller();
-
- // ui::EventHandler overrides:
- virtual void OnKeyEvent(ui::KeyEvent* key_event) OVERRIDE;
+ static ui::EventHandler* CreateHandler();
xiyuan 2014/02/14 01:50:21 Same here. Document the ownership of the returned
// A scoped object to enable and disable the magnifier accelerator for test.
class ScopedEnablerForTest {
@@ -42,22 +37,14 @@ class ASH_EXPORT MagnifierKeyScroller : public ui::EventHandler {
};
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
- };
+ // KeyHoldDetector overrides:
+ virtual bool ShouldProcessEvent(const ui::KeyEvent* event) const OVERRIDE;
+ virtual bool IsStartEvent(const ui::KeyEvent* event) const OVERRIDE;
+ virtual void OnKeyHold(const ui::KeyEvent* event) OVERRIDE;
+ virtual void OnKeyUnhold(const ui::KeyEvent* event) OVERRIDE;
- State state_;
+ MagnifierKeyScroller();
+ virtual ~MagnifierKeyScroller();
DISALLOW_COPY_AND_ASSIGN(MagnifierKeyScroller);
};

Powered by Google App Engine
This is Rietveld 408576698