OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
7 | 7 |
8 #include "ash/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
| 9 #include "ash/session_state_observer.h" |
9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
10 #include "base/prefs/pref_change_registrar.h" | 11 #include "base/prefs/pref_change_registrar.h" |
11 #include "base/time/time.h" | 12 #include "base/time/time.h" |
12 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 13 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
13 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" | 14 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" |
14 #include "chrome/browser/extensions/extension_system.h" | 15 #include "chrome/browser/extensions/extension_system.h" |
15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
17 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
18 | 19 |
(...skipping 14 matching lines...) Expand all Loading... |
33 bool enabled; | 34 bool enabled; |
34 ash::MagnifierType magnifier_type; | 35 ash::MagnifierType magnifier_type; |
35 ash::AccessibilityNotificationVisibility notify; | 36 ash::AccessibilityNotificationVisibility notify; |
36 }; | 37 }; |
37 | 38 |
38 // AccessibilityManager changes the statuses of accessibility features | 39 // AccessibilityManager changes the statuses of accessibility features |
39 // watching profile notifications and pref-changes. | 40 // watching profile notifications and pref-changes. |
40 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. | 41 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. |
41 class AccessibilityManager : public content::NotificationObserver, | 42 class AccessibilityManager : public content::NotificationObserver, |
42 public extensions::EventRouter::Observer, | 43 public extensions::EventRouter::Observer, |
43 extensions::api::braille_display_private::BrailleObserver { | 44 extensions::api::braille_display_private::BrailleObserver, |
| 45 public ash::SessionStateObserver { |
44 public: | 46 public: |
45 // Creates an instance of AccessibilityManager, this should be called once, | 47 // Creates an instance of AccessibilityManager, this should be called once, |
46 // because only one instance should exist at the same time. | 48 // because only one instance should exist at the same time. |
47 static void Initialize(); | 49 static void Initialize(); |
48 // Deletes the existing instance of AccessibilityManager. | 50 // Deletes the existing instance of AccessibilityManager. |
49 static void Shutdown(); | 51 static void Shutdown(); |
50 // Returns the existing instance. If there is no instance, returns NULL. | 52 // Returns the existing instance. If there is no instance, returns NULL. |
51 static AccessibilityManager* Get(); | 53 static AccessibilityManager* Get(); |
52 | 54 |
53 // On a user's first login into a device, any a11y features enabled/disabled | 55 // On a user's first login into a device, any a11y features enabled/disabled |
54 // by the user on the login screen are enabled/disabled in the user's profile. | 56 // by the user on the login screen are enabled/disabled in the user's profile. |
55 // This class watches for profile changes and copies settings into the user's | 57 // This class watches for profile changes and copies settings into the user's |
56 // profile when it detects a login with a newly created profile. | 58 // profile when it detects a login with a newly created profile. |
57 class PrefHandler { | 59 class PrefHandler { |
58 public: | 60 public: |
59 explicit PrefHandler(const char* pref_path); | 61 explicit PrefHandler(const char* pref_path); |
60 virtual ~PrefHandler(); | 62 virtual ~PrefHandler(); |
61 | 63 |
62 // Should be called from AccessibilityManager::SetProfile(). | 64 // Should be called from AccessibilityManager::SetProfile(). |
63 void HandleProfileChanged(Profile* previous_profile, | 65 void HandleProfileChanged(Profile* previous_profile, |
64 Profile* current_profile); | 66 Profile* current_profile); |
65 | 67 |
66 private: | 68 private: |
67 const char* pref_path_; | 69 const char* pref_path_; |
68 }; | 70 }; |
69 | 71 |
| 72 // Returns true when the accessibility menu should be shown. |
| 73 bool ShouldShowAccessibilityMenu(); |
| 74 |
70 // Enables or disables the large cursor. | 75 // Enables or disables the large cursor. |
71 void EnableLargeCursor(bool enabled); | 76 void EnableLargeCursor(bool enabled); |
72 // Returns true if the large cursor is enabled, or false if not. | 77 // Returns true if the large cursor is enabled, or false if not. |
73 bool IsLargeCursorEnabled(); | 78 bool IsLargeCursorEnabled(); |
74 | 79 |
75 // Enables or disable Sticky Keys. | 80 // Enables or disable Sticky Keys. |
76 void EnableStickyKeys(bool enabled); | 81 void EnableStickyKeys(bool enabled); |
77 | 82 |
78 // Returns true if Incognito mode is allowed, or false if not. | 83 // Returns true if Incognito mode is allowed, or false if not. |
79 bool IsIncognitoAllowed(); | 84 bool IsIncognitoAllowed(); |
(...skipping 23 matching lines...) Expand all Loading... |
103 | 108 |
104 // Returns true if autoclick is enabled. | 109 // Returns true if autoclick is enabled. |
105 bool IsAutoclickEnabled(); | 110 bool IsAutoclickEnabled(); |
106 | 111 |
107 // Set the delay for autoclicking after stopping the cursor in milliseconds. | 112 // Set the delay for autoclicking after stopping the cursor in milliseconds. |
108 void SetAutoclickDelay(int delay_ms); | 113 void SetAutoclickDelay(int delay_ms); |
109 | 114 |
110 // Returns the autoclick delay in milliseconds. | 115 // Returns the autoclick delay in milliseconds. |
111 int GetAutoclickDelay() const; | 116 int GetAutoclickDelay() const; |
112 | 117 |
| 118 // SessionStateObserver overrides: |
| 119 virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE; |
| 120 |
113 void SetProfileForTest(Profile* profile); | 121 void SetProfileForTest(Profile* profile); |
114 | 122 |
115 static void SetBrailleControllerForTest( | 123 static void SetBrailleControllerForTest( |
116 extensions::api::braille_display_private::BrailleController* controller); | 124 extensions::api::braille_display_private::BrailleController* controller); |
117 | 125 |
118 // Enables/disables system sounds. | 126 // Enables/disables system sounds. |
119 void EnableSystemSounds(bool system_sounds_enabled); | 127 void EnableSystemSounds(bool system_sounds_enabled); |
120 | 128 |
121 // Initiates play of shutdown sound and returns it's duration. | 129 // Initiates play of shutdown sound and returns it's duration. |
122 base::TimeDelta PlayShutdownSound(); | 130 base::TimeDelta PlayShutdownSound(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 bool high_contrast_enabled_; | 206 bool high_contrast_enabled_; |
199 bool autoclick_enabled_; | 207 bool autoclick_enabled_; |
200 int autoclick_delay_ms_; | 208 int autoclick_delay_ms_; |
201 | 209 |
202 ash::AccessibilityNotificationVisibility spoken_feedback_notification_; | 210 ash::AccessibilityNotificationVisibility spoken_feedback_notification_; |
203 | 211 |
204 base::WeakPtrFactory<AccessibilityManager> weak_ptr_factory_; | 212 base::WeakPtrFactory<AccessibilityManager> weak_ptr_factory_; |
205 | 213 |
206 bool should_speak_chrome_vox_announcements_on_user_screen_; | 214 bool should_speak_chrome_vox_announcements_on_user_screen_; |
207 | 215 |
| 216 // True if the session state observer was installed. |
| 217 bool session_state_observer_installed_; |
| 218 |
208 bool system_sounds_enabled_; | 219 bool system_sounds_enabled_; |
209 | 220 |
210 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); | 221 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); |
211 }; | 222 }; |
212 | 223 |
213 } // namespace chromeos | 224 } // namespace chromeos |
214 | 225 |
215 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 226 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |