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

Unified Diff: ash/accelerators/spoken_feedback_toggler.h

Issue 164823005: Long press menu (shift+f6) to toggle spoken feedback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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/accelerators/magnifier_key_scroller_unittest.cc ('k') | ash/accelerators/spoken_feedback_toggler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/spoken_feedback_toggler.h
diff --git a/ash/accelerators/spoken_feedback_toggler.h b/ash/accelerators/spoken_feedback_toggler.h
new file mode 100644
index 0000000000000000000000000000000000000000..592c71c56e4d4be89154e5ad122ee024114bc601
--- /dev/null
+++ b/ash/accelerators/spoken_feedback_toggler.h
@@ -0,0 +1,57 @@
+// 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_ACCELERATORS_SPOKEN_FEEDBACK_TOGGLER_H_
+#define ASH_ACCELERATORS_SPOKEN_FEEDBACK_TOGGLER_H_
+
+#include "ash/accelerators/key_hold_detector.h"
+#include "ash/ash_export.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/events/event_handler.h"
+
+namespace ui {
+class KeyEvent;
+}
+
+namespace ash {
+
+// A KeyHoldDetector delegate to toggle spoken feedback.
+class ASH_EXPORT SpokenFeedbackToggler : public KeyHoldDetector::Delegate {
+ public:
+ static bool IsEnabled();
+ static void SetEnabled(bool enabled);
+ static scoped_ptr<ui::EventHandler> CreateHandler();
+
+ // 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:
+ // 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;
+
+ SpokenFeedbackToggler();
+ virtual ~SpokenFeedbackToggler();
+
+ bool toggled_;
+
+ DISALLOW_COPY_AND_ASSIGN(SpokenFeedbackToggler);
+};
+
+} // namespace ash
+
+#endif // ASH_ACCELERATORS_SPOKEN_FEEDBACK_TOGGLER_H_
« no previous file with comments | « ash/accelerators/magnifier_key_scroller_unittest.cc ('k') | ash/accelerators/spoken_feedback_toggler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698