| 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_COMMON_SYSTEM_TRAY_ACCESSIBILITY_H_ | |
| 6 #define ASH_COMMON_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_details_view.h" | |
| 14 #include "ash/common/system/tray/tray_image_item.h" | |
| 15 #include "ash/common/system/tray/tray_notification_view.h" | |
| 16 #include "base/macros.h" | |
| 17 #include "ui/gfx/font.h" | |
| 18 #include "ui/views/controls/button/button.h" | |
| 19 | |
| 20 namespace chromeos { | |
| 21 class TrayAccessibilityTest; | |
| 22 } | |
| 23 | |
| 24 namespace gfx { | |
| 25 struct VectorIcon; | |
| 26 } | |
| 27 | |
| 28 namespace views { | |
| 29 class Button; | |
| 30 class CustomButton; | |
| 31 class Label; | |
| 32 class View; | |
| 33 } | |
| 34 | |
| 35 namespace ash { | |
| 36 class HoverHighlightView; | |
| 37 class SystemTrayItem; | |
| 38 | |
| 39 namespace tray { | |
| 40 | |
| 41 class AccessibilityPopupView : public TrayNotificationView { | |
| 42 public: | |
| 43 explicit AccessibilityPopupView(uint32_t enabled_state_bits); | |
| 44 | |
| 45 const views::Label* label_for_test() const { return label_; } | |
| 46 | |
| 47 private: | |
| 48 views::Label* CreateLabel(uint32_t enabled_state_bits); | |
| 49 | |
| 50 views::Label* label_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(AccessibilityPopupView); | |
| 53 }; | |
| 54 | |
| 55 // Create the detailed view of accessibility tray. | |
| 56 class AccessibilityDetailedView : public TrayDetailsView, | |
| 57 public ShellObserver { | |
| 58 public: | |
| 59 AccessibilityDetailedView(SystemTrayItem* owner, LoginStatus login); | |
| 60 ~AccessibilityDetailedView() override {} | |
| 61 | |
| 62 private: | |
| 63 // TrayDetailsView: | |
| 64 void HandleViewClicked(views::View* view) override; | |
| 65 void HandleButtonPressed(views::Button* sender, | |
| 66 const ui::Event& event) override; | |
| 67 void CreateExtraTitleRowButtons() override; | |
| 68 | |
| 69 // Launches the WebUI settings in a browser and closes the system menu. | |
| 70 void ShowSettings(); | |
| 71 | |
| 72 // Launches the a11y help article in a browser and closes the system menu. | |
| 73 void ShowHelp(); | |
| 74 | |
| 75 // Add the accessibility feature list. | |
| 76 void AppendAccessibilityList(); | |
| 77 | |
| 78 // Helper function to create entries in the detailed accessibility view. | |
| 79 HoverHighlightView* AddScrollListItem(const base::string16& text, | |
| 80 bool highlight, | |
| 81 bool checked, | |
| 82 const gfx::VectorIcon& icon); | |
| 83 | |
| 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::CustomButton* help_view_; | |
| 89 views::CustomButton* settings_view_; | |
| 90 views::View* autoclick_view_; | |
| 91 views::View* virtual_keyboard_view_; | |
| 92 | |
| 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 LoginStatus login_; | |
| 100 | |
| 101 friend class chromeos::TrayAccessibilityTest; | |
| 102 DISALLOW_COPY_AND_ASSIGN(AccessibilityDetailedView); | |
| 103 }; | |
| 104 | |
| 105 } // namespace tray | |
| 106 | |
| 107 class TrayAccessibility : public TrayImageItem, public AccessibilityObserver { | |
| 108 public: | |
| 109 explicit TrayAccessibility(SystemTray* system_tray); | |
| 110 ~TrayAccessibility() override; | |
| 111 | |
| 112 private: | |
| 113 void SetTrayIconVisible(bool visible); | |
| 114 tray::AccessibilityDetailedView* CreateDetailedMenu(); | |
| 115 | |
| 116 // Overridden from TrayImageItem. | |
| 117 bool GetInitialVisibility() override; | |
| 118 views::View* CreateDefaultView(LoginStatus status) override; | |
| 119 views::View* CreateDetailedView(LoginStatus status) override; | |
| 120 void DestroyDefaultView() override; | |
| 121 void DestroyDetailedView() override; | |
| 122 void UpdateAfterLoginStatusChange(LoginStatus status) override; | |
| 123 | |
| 124 // Overridden from AccessibilityObserver. | |
| 125 void OnAccessibilityModeChanged( | |
| 126 AccessibilityNotificationVisibility notify) override; | |
| 127 | |
| 128 views::View* default_; | |
| 129 tray::AccessibilityPopupView* detailed_popup_; | |
| 130 tray::AccessibilityDetailedView* detailed_menu_; | |
| 131 | |
| 132 // Bitmap of fvalues from AccessibilityState. Can contain any or | |
| 133 // both of A11Y_SPOKEN_FEEDBACK A11Y_BRAILLE_DISPLAY_CONNECTED. | |
| 134 uint32_t request_popup_view_state_; | |
| 135 | |
| 136 bool tray_icon_visible_; | |
| 137 LoginStatus login_; | |
| 138 | |
| 139 // Bitmap of values from AccessibilityState enum. | |
| 140 uint32_t previous_accessibility_state_; | |
| 141 | |
| 142 // A11y feature status on just entering the lock screen. | |
| 143 bool show_a11y_menu_on_lock_screen_; | |
| 144 | |
| 145 friend class chromeos::TrayAccessibilityTest; | |
| 146 DISALLOW_COPY_AND_ASSIGN(TrayAccessibility); | |
| 147 }; | |
| 148 | |
| 149 } // namespace ash | |
| 150 | |
| 151 #endif // ASH_COMMON_SYSTEM_TRAY_ACCESSIBILITY_H_ | |
| OLD | NEW |