Home | History | Annotate | Download | only in system
      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 "ash/shell_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/view_click_listener.h"
     13 #include "base/gtest_prod_util.h"
     14 #include "ui/gfx/font.h"
     15 #include "ui/views/controls/button/button.h"
     16 
     17 namespace chromeos {
     18 class TrayAccessibilityTest;
     19 }
     20 
     21 namespace views {
     22 class Button;
     23 class ImageView;
     24 class View;
     25 }
     26 
     27 namespace ash {
     28 
     29 class SystemTrayItem;
     30 
     31 class ASH_EXPORT AccessibilityObserver {
     32  public:
     33   virtual ~AccessibilityObserver() {}
     34 
     35   // Notifies when accessibilty mode changes.
     36   virtual void OnAccessibilityModeChanged(
     37       AccessibilityNotificationVisibility notify) = 0;
     38 };
     39 
     40 namespace internal {
     41 
     42 class HoverHighlightView;
     43 
     44 namespace tray {
     45 
     46 class AccessibilityPopupView;
     47 
     48 class AccessibilityDetailedView : public TrayDetailsView,
     49                                   public ViewClickListener,
     50                                   public views::ButtonListener,
     51                                   public ShellObserver {
     52  public:
     53   explicit AccessibilityDetailedView(SystemTrayItem* owner,
     54                                      user::LoginStatus login);
     55   virtual ~AccessibilityDetailedView() {}
     56 
     57  private:
     58   // Add the accessibility feature list.
     59   void AppendAccessibilityList();
     60 
     61   // Add help entries.
     62   void AppendHelpEntries();
     63 
     64   HoverHighlightView* AddScrollListItem(const base::string16& text,
     65                                         gfx::Font::FontStyle style,
     66                                         bool checked);
     67   // Overridden from ViewClickListener.
     68   virtual void OnViewClicked(views::View* sender) OVERRIDE;
     69   // Overridden from ButtonListener.
     70   virtual void ButtonPressed(views::Button* sender,
     71                              const ui::Event& event) OVERRIDE;
     72 
     73   views::View* spoken_feedback_view_;
     74   views::View* high_contrast_view_;
     75   views::View* screen_magnifier_view_;;
     76   views::View* large_cursor_view_;;
     77   views::View* help_view_;
     78   views::View* settings_view_;
     79 
     80   bool spoken_feedback_enabled_;
     81   bool high_contrast_enabled_;
     82   bool screen_magnifier_enabled_;
     83   bool large_cursor_enabled_;
     84   user::LoginStatus login_;
     85 
     86   friend class chromeos::TrayAccessibilityTest;
     87   DISALLOW_COPY_AND_ASSIGN(AccessibilityDetailedView);
     88 };
     89 
     90 }  // namespace tray
     91 
     92 class TrayAccessibility : public TrayImageItem,
     93                           public AccessibilityObserver {
     94  public:
     95   explicit TrayAccessibility(SystemTray* system_tray);
     96   virtual ~TrayAccessibility();
     97 
     98  private:
     99   void SetTrayIconVisible(bool visible);
    100   tray::AccessibilityDetailedView* CreateDetailedMenu();
    101 
    102   // Overridden from TrayImageItem.
    103   virtual bool GetInitialVisibility() OVERRIDE;
    104   virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
    105   virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
    106   virtual void DestroyDefaultView() OVERRIDE;
    107   virtual void DestroyDetailedView() OVERRIDE;
    108   virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE;
    109 
    110   // Overridden from AccessibilityObserver.
    111   virtual void OnAccessibilityModeChanged(
    112       AccessibilityNotificationVisibility notify) OVERRIDE;
    113 
    114   views::View* default_;
    115   tray::AccessibilityPopupView* detailed_popup_;
    116   tray::AccessibilityDetailedView* detailed_menu_;
    117 
    118   bool request_popup_view_;
    119   bool tray_icon_visible_;
    120   user::LoginStatus login_;
    121 
    122   // Bitmap of values from AccessibilityState enum.
    123   uint32 previous_accessibility_state_;
    124 
    125   // A11y feature status on just entering the lock screen.
    126   bool show_a11y_menu_on_lock_screen_;
    127 
    128   friend class chromeos::TrayAccessibilityTest;
    129   DISALLOW_COPY_AND_ASSIGN(TrayAccessibility);
    130 };
    131 
    132 }  // namespace internal
    133 }  // namespace ash
    134 
    135 #endif  // ASH_SYSTEM_TRAY_ACCESSIBILITY_H_
    136