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"
19 class TrayAccessibilityTest
;
30 class HoverHighlightView
;
33 class ASH_EXPORT AccessibilityObserver
{
35 virtual ~AccessibilityObserver() {}
37 // Notifies when accessibilty mode changes.
38 virtual void OnAccessibilityModeChanged(
39 AccessibilityNotificationVisibility notify
) = 0;
45 class AccessibilityPopupView
: public TrayNotificationView
{
47 AccessibilityPopupView(SystemTrayItem
* owner
, uint32 enabled_state_bits
);
49 const views::Label
* label_for_test() const { return label_
; }
52 views::Label
* CreateLabel(uint32 enabled_state_bits
);
56 DISALLOW_COPY_AND_ASSIGN(AccessibilityPopupView
);
59 class AccessibilityDetailedView
: public TrayDetailsView
,
60 public ViewClickListener
,
61 public views::ButtonListener
,
62 public ShellObserver
{
64 explicit AccessibilityDetailedView(SystemTrayItem
* owner
,
65 user::LoginStatus login
);
66 virtual ~AccessibilityDetailedView() {}
69 // Add the accessibility feature list.
70 void AppendAccessibilityList();
73 void AppendHelpEntries();
75 HoverHighlightView
* AddScrollListItem(const base::string16
& text
,
76 gfx::Font::FontStyle style
,
78 // Overridden from ViewClickListener.
79 virtual void OnViewClicked(views::View
* sender
) OVERRIDE
;
80 // Overridden from ButtonListener.
81 virtual void ButtonPressed(views::Button
* sender
,
82 const ui::Event
& event
) OVERRIDE
;
84 views::View
* spoken_feedback_view_
;
85 views::View
* high_contrast_view_
;
86 views::View
* screen_magnifier_view_
;
87 views::View
* large_cursor_view_
;
88 views::View
* help_view_
;
89 views::View
* settings_view_
;
90 views::View
* autoclick_view_
;
91 views::View
* virtual_keyboard_view_
;
93 bool spoken_feedback_enabled_
;
94 bool high_contrast_enabled_
;
95 bool screen_magnifier_enabled_
;
96 bool large_cursor_enabled_
;
97 bool autoclick_enabled_
;
98 bool virtual_keyboard_enabled_
;
99 user::LoginStatus login_
;
101 friend class chromeos::TrayAccessibilityTest
;
102 DISALLOW_COPY_AND_ASSIGN(AccessibilityDetailedView
);
107 class TrayAccessibility
: public TrayImageItem
,
108 public AccessibilityObserver
{
110 explicit TrayAccessibility(SystemTray
* system_tray
);
111 virtual ~TrayAccessibility();
114 void SetTrayIconVisible(bool visible
);
115 tray::AccessibilityDetailedView
* CreateDetailedMenu();
117 // Overridden from TrayImageItem.
118 virtual bool GetInitialVisibility() OVERRIDE
;
119 virtual views::View
* CreateDefaultView(user::LoginStatus status
) OVERRIDE
;
120 virtual views::View
* CreateDetailedView(user::LoginStatus status
) OVERRIDE
;
121 virtual void DestroyDefaultView() OVERRIDE
;
122 virtual void DestroyDetailedView() OVERRIDE
;
123 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status
) OVERRIDE
;
125 // Overridden from AccessibilityObserver.
126 virtual void OnAccessibilityModeChanged(
127 AccessibilityNotificationVisibility notify
) OVERRIDE
;
129 views::View
* default_
;
130 tray::AccessibilityPopupView
* detailed_popup_
;
131 tray::AccessibilityDetailedView
* detailed_menu_
;
133 // Bitmap of fvalues from AccessibilityState. Can contain any or
134 // both of A11Y_SPOKEN_FEEDBACK A11Y_BRAILLE_DISPLAY_CONNECTED.
135 uint32 request_popup_view_state_
;
137 bool tray_icon_visible_
;
138 user::LoginStatus login_
;
140 // Bitmap of values from AccessibilityState enum.
141 uint32 previous_accessibility_state_
;
143 // A11y feature status on just entering the lock screen.
144 bool show_a11y_menu_on_lock_screen_
;
146 friend class chromeos::TrayAccessibilityTest
;
147 DISALLOW_COPY_AND_ASSIGN(TrayAccessibility
);
152 #endif // ASH_SYSTEM_TRAY_ACCESSIBILITY_H_