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

Side by Side Diff: chrome/browser/chromeos/accessibility/spoken_feedback_event_rewriter.h

Issue 1185753008: Proposed alternative for supporting ChromeVox keyboard commands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove ui/events/* changes. Created 5 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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 CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SPOKEN_FEEDBACK_EVENT_REWRITER_H_
6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SPOKEN_FEEDBACK_EVENT_REWRITER_H_
7
8 #include <vector>
9
10 #include "ui/events/event_rewriter.h"
11
12 namespace ui {
13 class KeyEvent;
14 }
15
16 // Receives requests for spoken feedback enabled state and command dispatch.
17 class SpokenFeedbackEventRewriterDelegate {
18 public:
19 SpokenFeedbackEventRewriterDelegate() {}
20 virtual ~SpokenFeedbackEventRewriterDelegate() {}
21
22 // Returns true when ChromeVox is enabled.
23 virtual bool IsSpokenFeedbackEnabled() const;
24
25 // Returns true when |key_event| is dispatched to ChromeVox.
26 virtual bool DispatchKeyToChromeVox(const ui::KeyEvent key_event);
27
28 private:
29 DISALLOW_COPY_AND_ASSIGN(SpokenFeedbackEventRewriterDelegate);
30 };
31
32 // SpokenFeedbackEventRewriter discards all keyboard events mapped by the spoken
33 // feedback manifest commands block. It dispatches the associated command name
34 // directly to spoken feedback. This only occurs whenever spoken feedback is
35 // enabled.
36 class SpokenFeedbackEventRewriter : public ui::EventRewriter {
37 public:
38 explicit SpokenFeedbackEventRewriter(
39 SpokenFeedbackEventRewriterDelegate* delegate);
40 ~SpokenFeedbackEventRewriter() override;
41
42 // EventRewriter:
43 ui::EventRewriteStatus RewriteEvent(
44 const ui::Event& event,
45 scoped_ptr<ui::Event>* new_event) override;
46 ui::EventRewriteStatus NextDispatchEvent(
47 const ui::Event& last_event,
48 scoped_ptr<ui::Event>* new_event) override;
49
50 private:
51 // Default delegate implementation.
52 SpokenFeedbackEventRewriterDelegate default_delegate_;
53
54 // Active delegate (used for testing).
55 SpokenFeedbackEventRewriterDelegate* delegate_;
56
57 // Stores all key codes we've captured.
58 std::vector<int> captured_key_codes_;
59
60 DISALLOW_COPY_AND_ASSIGN(SpokenFeedbackEventRewriter);
61 };
62
63 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SPOKEN_FEEDBACK_EVENT_REWRITER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698