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_ACCELERATORS_SPOKEN_FEEDBACK_TOGGLER_H_ | |
| 6 #define ASH_ACCELERATORS_SPOKEN_FEEDBACK_TOGGLER_H_ | |
| 7 | |
| 8 #include "ash/accelerators/key_hold_detector.h" | |
| 9 #include "ash/ash_export.h" | |
| 10 #include "ui/events/event_handler.h" | |
| 11 | |
| 12 namespace ui { | |
| 13 class KeyEvent; | |
| 14 } | |
| 15 | |
| 16 namespace ash { | |
| 17 | |
| 18 // A KeyHoldDetector delegate to toggle spoken feedback. | |
| 19 class ASH_EXPORT SpokenFeedbackToggler : public KeyHoldDetector::Delegate { | |
| 20 public: | |
| 21 static bool IsEnabled(); | |
| 22 static void SetEnabled(bool enabled); | |
| 23 static ui::EventHandler* CreateHandler(); | |
|
xiyuan
2014/02/14 01:50:21
Document the ownership of the returned object and
oshima
2014/02/14 18:03:25
This is static so I don't think it's necessary to
| |
| 24 | |
| 25 // A scoped object to enable and disable the magnifier accelerator for test. | |
| 26 class ScopedEnablerForTest { | |
| 27 public: | |
| 28 ScopedEnablerForTest() { | |
| 29 SetEnabled(true); | |
| 30 } | |
| 31 ~ScopedEnablerForTest() { | |
| 32 SetEnabled(false); | |
| 33 } | |
| 34 | |
| 35 private: | |
| 36 DISALLOW_COPY_AND_ASSIGN(ScopedEnablerForTest); | |
| 37 }; | |
| 38 | |
| 39 private: | |
| 40 // KeyHoldDetector overrides: | |
| 41 virtual bool ShouldProcessEvent(const ui::KeyEvent* event) const OVERRIDE; | |
| 42 virtual bool IsStartEvent(const ui::KeyEvent* event) const OVERRIDE; | |
| 43 virtual void OnKeyHold(const ui::KeyEvent* event) OVERRIDE; | |
| 44 virtual void OnKeyUnhold(const ui::KeyEvent* event) OVERRIDE; | |
| 45 | |
| 46 SpokenFeedbackToggler(); | |
| 47 virtual ~SpokenFeedbackToggler(); | |
| 48 | |
| 49 bool toggled_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(SpokenFeedbackToggler); | |
| 52 }; | |
| 53 | |
| 54 } // namespace ash | |
| 55 | |
| 56 #endif // ASH_ACCELERATORS_SPOKEN_FEEDBACK_TOGGLER_H_ | |
| OLD | NEW |