OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_SYSTEM_TRAY_ACCESSIBILITY_H_ | |
6 #define ASH_SYSTEM_TRAY_ACCESSIBILITY_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "ash/common/accessibility_delegate.h" | |
11 #include "ash/common/shell_observer.h" | |
12 #include "ash/common/system/accessibility_observer.h" | |
13 #include "ash/common/system/tray/tray_image_item.h" | |
14 #include "ash/common/system/tray/tray_notification_view.h" | |
15 #include "ash/common/system/tray/view_click_listener.h" | |
16 #include "ash/system/tray/tray_details_view.h" | |
17 #include "base/macros.h" | |
18 #include "ui/gfx/font.h" | |
19 #include "ui/views/controls/button/button.h" | |
20 | |
21 namespace chromeos { | |
22 class TrayAccessibilityTest; | |
23 } | |
24 | |
25 namespace views { | |
26 class Button; | |
27 class ImageView; | |
28 class Label; | |
29 class View; | |
30 } | |
31 | |
32 namespace ash { | |
33 class HoverHighlightView; | |
34 class SystemTrayItem; | |
35 | |
36 namespace tray { | |
37 | |
38 class AccessibilityPopupView : public TrayNotificationView { | |
39 public: | |
40 AccessibilityPopupView(SystemTrayItem* owner, uint32_t enabled_state_bits); | |
41 | |
42 const views::Label* label_for_test() const { return label_; } | |
43 | |
44 private: | |
45 views::Label* CreateLabel(uint32_t enabled_state_bits); | |
46 | |
47 views::Label* label_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(AccessibilityPopupView); | |
50 }; | |
51 | |
52 class AccessibilityDetailedView : public TrayDetailsView, | |
53 public ViewClickListener, | |
54 public views::ButtonListener, | |
55 public ShellObserver { | |
56 public: | |
57 AccessibilityDetailedView(SystemTrayItem* owner, LoginStatus login); | |
58 ~AccessibilityDetailedView() override {} | |
59 | |
60 private: | |
61 // Add the accessibility feature list. | |
62 void AppendAccessibilityList(); | |
63 | |
64 // Add help entries. | |
65 void AppendHelpEntries(); | |
66 | |
67 HoverHighlightView* AddScrollListItem(const base::string16& text, | |
68 bool highlight, | |
69 bool checked); | |
70 // Overridden from ViewClickListener. | |
71 void OnViewClicked(views::View* sender) override; | |
72 // Overridden from ButtonListener. | |
73 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | |
74 | |
75 views::View* spoken_feedback_view_; | |
76 views::View* high_contrast_view_; | |
77 views::View* screen_magnifier_view_; | |
78 views::View* large_cursor_view_; | |
79 views::View* help_view_; | |
80 views::View* settings_view_; | |
81 views::View* autoclick_view_; | |
82 views::View* virtual_keyboard_view_; | |
83 | |
84 bool spoken_feedback_enabled_; | |
85 bool high_contrast_enabled_; | |
86 bool screen_magnifier_enabled_; | |
87 bool large_cursor_enabled_; | |
88 bool autoclick_enabled_; | |
89 bool virtual_keyboard_enabled_; | |
90 LoginStatus login_; | |
91 | |
92 friend class chromeos::TrayAccessibilityTest; | |
93 DISALLOW_COPY_AND_ASSIGN(AccessibilityDetailedView); | |
94 }; | |
95 | |
96 } // namespace tray | |
97 | |
98 class TrayAccessibility : public TrayImageItem, | |
99 public AccessibilityObserver { | |
100 public: | |
101 explicit TrayAccessibility(SystemTray* system_tray); | |
102 ~TrayAccessibility() override; | |
103 | |
104 private: | |
105 void SetTrayIconVisible(bool visible); | |
106 tray::AccessibilityDetailedView* CreateDetailedMenu(); | |
107 | |
108 // Overridden from TrayImageItem. | |
109 bool GetInitialVisibility() override; | |
110 views::View* CreateDefaultView(LoginStatus status) override; | |
111 views::View* CreateDetailedView(LoginStatus status) override; | |
112 void DestroyDefaultView() override; | |
113 void DestroyDetailedView() override; | |
114 void UpdateAfterLoginStatusChange(LoginStatus status) override; | |
115 | |
116 // Overridden from AccessibilityObserver. | |
117 void OnAccessibilityModeChanged( | |
118 AccessibilityNotificationVisibility notify) override; | |
119 | |
120 views::View* default_; | |
121 tray::AccessibilityPopupView* detailed_popup_; | |
122 tray::AccessibilityDetailedView* detailed_menu_; | |
123 | |
124 // Bitmap of fvalues from AccessibilityState. Can contain any or | |
125 // both of A11Y_SPOKEN_FEEDBACK A11Y_BRAILLE_DISPLAY_CONNECTED. | |
126 uint32_t request_popup_view_state_; | |
127 | |
128 bool tray_icon_visible_; | |
129 LoginStatus login_; | |
130 | |
131 // Bitmap of values from AccessibilityState enum. | |
132 uint32_t previous_accessibility_state_; | |
133 | |
134 // A11y feature status on just entering the lock screen. | |
135 bool show_a11y_menu_on_lock_screen_; | |
136 | |
137 friend class chromeos::TrayAccessibilityTest; | |
138 DISALLOW_COPY_AND_ASSIGN(TrayAccessibility); | |
139 }; | |
140 | |
141 } // namespace ash | |
142 | |
143 #endif // ASH_SYSTEM_TRAY_ACCESSIBILITY_H_ | |
OLD | NEW |