Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / ash / system / tray_accessibility.h
blob44ab64d3070af17a0b3a24ac765123e4734216cb
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.
5 #ifndef ASH_SYSTEM_TRAY_ACCESSIBILITY_H_
6 #define ASH_SYSTEM_TRAY_ACCESSIBILITY_H_
8 #include "ash/accessibility_delegate.h"
9 #include "ash/shell_observer.h"
10 #include "ash/system/tray/tray_details_view.h"
11 #include "ash/system/tray/tray_image_item.h"
12 #include "ash/system/tray/tray_notification_view.h"
13 #include "ash/system/tray/view_click_listener.h"
14 #include "base/gtest_prod_util.h"
15 #include "ui/gfx/font.h"
16 #include "ui/views/controls/button/button.h"
18 namespace chromeos {
19 class TrayAccessibilityTest;
22 namespace views {
23 class Button;
24 class ImageView;
25 class Label;
26 class View;
29 namespace ash {
30 class HoverHighlightView;
31 class SystemTrayItem;
33 class ASH_EXPORT AccessibilityObserver {
34 public:
35 virtual ~AccessibilityObserver() {}
37 // Notifies when accessibility mode changes.
38 virtual void OnAccessibilityModeChanged(
39 ui::AccessibilityNotificationVisibility notify) = 0;
43 namespace tray {
45 class AccessibilityPopupView : public TrayNotificationView {
46 public:
47 AccessibilityPopupView(SystemTrayItem* owner, uint32 enabled_state_bits);
49 const views::Label* label_for_test() const { return label_; }
51 private:
52 views::Label* CreateLabel(uint32 enabled_state_bits);
54 views::Label* label_;
56 DISALLOW_COPY_AND_ASSIGN(AccessibilityPopupView);
59 class AccessibilityDetailedView : public TrayDetailsView,
60 public ViewClickListener,
61 public views::ButtonListener,
62 public ShellObserver {
63 public:
64 explicit AccessibilityDetailedView(SystemTrayItem* owner,
65 user::LoginStatus login);
66 ~AccessibilityDetailedView() override {}
68 private:
69 // Add the accessibility feature list.
70 void AppendAccessibilityList();
72 // Add help entries.
73 void AppendHelpEntries();
75 HoverHighlightView* AddScrollListItem(const base::string16& text,
76 bool highlight,
77 bool checked);
78 // Overridden from ViewClickListener.
79 void OnViewClicked(views::View* sender) override;
80 // Overridden from ButtonListener.
81 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
83 views::View* spoken_feedback_view_;
84 views::View* high_contrast_view_;
85 views::View* screen_magnifier_view_;
86 views::View* large_cursor_view_;
87 views::View* help_view_;
88 views::View* settings_view_;
89 views::View* autoclick_view_;
90 views::View* virtual_keyboard_view_;
92 bool spoken_feedback_enabled_;
93 bool high_contrast_enabled_;
94 bool screen_magnifier_enabled_;
95 bool large_cursor_enabled_;
96 bool autoclick_enabled_;
97 bool virtual_keyboard_enabled_;
98 user::LoginStatus login_;
100 friend class chromeos::TrayAccessibilityTest;
101 DISALLOW_COPY_AND_ASSIGN(AccessibilityDetailedView);
104 } // namespace tray
106 class TrayAccessibility : public TrayImageItem,
107 public AccessibilityObserver {
108 public:
109 explicit TrayAccessibility(SystemTray* system_tray);
110 ~TrayAccessibility() override;
112 private:
113 void SetTrayIconVisible(bool visible);
114 tray::AccessibilityDetailedView* CreateDetailedMenu();
116 // Overridden from TrayImageItem.
117 bool GetInitialVisibility() override;
118 views::View* CreateDefaultView(user::LoginStatus status) override;
119 views::View* CreateDetailedView(user::LoginStatus status) override;
120 void DestroyDefaultView() override;
121 void DestroyDetailedView() override;
122 void UpdateAfterLoginStatusChange(user::LoginStatus status) override;
124 // Overridden from AccessibilityObserver.
125 void OnAccessibilityModeChanged(
126 ui::AccessibilityNotificationVisibility notify) override;
128 views::View* default_;
129 tray::AccessibilityPopupView* detailed_popup_;
130 tray::AccessibilityDetailedView* detailed_menu_;
132 // Bitmap of fvalues from AccessibilityState. Can contain any or
133 // both of A11Y_SPOKEN_FEEDBACK A11Y_BRAILLE_DISPLAY_CONNECTED.
134 uint32 request_popup_view_state_;
136 bool tray_icon_visible_;
137 user::LoginStatus login_;
139 // Bitmap of values from AccessibilityState enum.
140 uint32 previous_accessibility_state_;
142 // A11y feature status on just entering the lock screen.
143 bool show_a11y_menu_on_lock_screen_;
145 friend class chromeos::TrayAccessibilityTest;
146 DISALLOW_COPY_AND_ASSIGN(TrayAccessibility);
149 } // namespace ash
151 #endif // ASH_SYSTEM_TRAY_ACCESSIBILITY_H_