OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 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_ACCESSIBILITY_HIGHLIGHT_MANAGER_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_HIGHLIGHT_MANAGER_H_ | |
7 | |
8 #include "content/public/browser/notification_details.h" | |
9 #include "content/public/browser/notification_observer.h" | |
10 #include "content/public/browser/notification_registrar.h" | |
11 #include "content/public/browser/notification_source.h" | |
12 #include "ui/base/ime/input_method.h" | |
13 #include "ui/base/ime/input_method_observer.h" | |
14 #include "ui/base/ime/text_input_client.h" | |
15 #include "ui/events/event.h" | |
16 #include "ui/events/event_handler.h" | |
17 | |
18 namespace chromeos { | |
19 | |
20 // Manage visual highlights that Chrome OS can draw around the focused | |
21 // object, the cursor, and the text caret for accessibility. | |
22 class AccessibilityHighlightManager : public ui::EventHandler, | |
23 public content::NotificationObserver, | |
24 public ui::InputMethodObserver { | |
25 public: | |
26 AccessibilityHighlightManager(); | |
27 ~AccessibilityHighlightManager() override; | |
28 | |
29 void HighlightFocus(bool focus); | |
30 void HighlightCursor(bool cursor); | |
31 void HighlightCaret(bool caret); | |
32 | |
33 private: | |
34 // ui::EventHandler overrides: | |
35 void OnMouseEvent(ui::MouseEvent* event) override; | |
36 | |
37 // content::NotificationObserver overrides: | |
38 void Observe(int type, | |
39 const content::NotificationSource& source, | |
40 const content::NotificationDetails& details) override; | |
41 | |
42 // ui::InputMethodObserver overrides: | |
43 void OnTextInputTypeChanged(const ui::TextInputClient* client) override {} | |
44 void OnFocus() override {} | |
45 void OnBlur() override {} | |
46 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override {} | |
47 void OnShowImeIfNeeded() override {} | |
48 void OnTextInputStateChanged(const ui::TextInputClient* client) override; | |
49 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; | |
50 | |
51 bool focus_ = false; | |
52 gfx::Rect focus_rect_; | |
53 | |
54 bool cursor_ = false; | |
55 gfx::Point cursor_point_; | |
56 | |
57 bool caret_ = false; | |
58 gfx::Point caret_point_; | |
59 | |
60 content::NotificationRegistrar registrar_; | |
61 }; | |
xiyuan
2016/03/21 22:59:31
nit: DISALLOW_COPY_AND_ASSIGN(AccessibilityHighlig
dmazzoni
2016/03/22 04:09:30
Done.
| |
62 | |
63 } // namespace chromeos | |
64 | |
65 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_HIGHLIGHT_MANAGER _H_ | |
OLD | NEW |