BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / chromeos / accessibility / spoken_feedback_event_rewriter.h
blobc0c7f7ea4339255f0ff5d95bfaaff836650a9e42
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.
5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SPOKEN_FEEDBACK_EVENT_REWRITER_H_
6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SPOKEN_FEEDBACK_EVENT_REWRITER_H_
8 #include <vector>
10 #include "ui/events/event_rewriter.h"
12 namespace ui {
13 class KeyEvent;
16 // Receives requests for spoken feedback enabled state and command dispatch.
17 class SpokenFeedbackEventRewriterDelegate {
18 public:
19 SpokenFeedbackEventRewriterDelegate();
20 virtual ~SpokenFeedbackEventRewriterDelegate() {}
22 // Returns true when ChromeVox is enabled.
23 virtual bool IsSpokenFeedbackEnabled() const;
25 // Returns true when |key_event| is dispatched to ChromeVox.
26 virtual bool DispatchKeyEventToChromeVox(const ui::KeyEvent& key_event);
28 private:
29 // Whether the user previously hit a sequencing prefix command.
30 bool is_sequencing_;
32 DISALLOW_COPY_AND_ASSIGN(SpokenFeedbackEventRewriterDelegate);
35 // SpokenFeedbackEventRewriter discards all keyboard events mapped by the spoken
36 // feedback manifest commands block. It dispatches the associated command name
37 // directly to spoken feedback. This only occurs whenever spoken feedback is
38 // enabled.
39 class SpokenFeedbackEventRewriter : public ui::EventRewriter {
40 public:
41 SpokenFeedbackEventRewriter();
42 ~SpokenFeedbackEventRewriter() override;
44 void SetDelegateForTest(
45 scoped_ptr<SpokenFeedbackEventRewriterDelegate> delegate);
47 private:
48 // EventRewriter:
49 ui::EventRewriteStatus RewriteEvent(
50 const ui::Event& event,
51 scoped_ptr<ui::Event>* new_event) override;
52 ui::EventRewriteStatus NextDispatchEvent(
53 const ui::Event& last_event,
54 scoped_ptr<ui::Event>* new_event) override;
56 // Active delegate (used for testing).
57 scoped_ptr<SpokenFeedbackEventRewriterDelegate> delegate_;
59 // Stores all key codes we've captured.
60 std::vector<int> captured_key_codes_;
62 DISALLOW_COPY_AND_ASSIGN(SpokenFeedbackEventRewriter);
65 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_SPOKEN_FEEDBACK_EVENT_REWRITER_H_