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 <set> | 8 #include <set> |
9 | 9 |
10 #include "ash/accessibility_delegate.h" | 10 #include "ash/accessibility_delegate.h" |
11 #include "ash/session_state_observer.h" | 11 #include "ash/session_state_observer.h" |
12 #include "base/callback_list.h" | 12 #include "base/callback_list.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/prefs/pref_change_registrar.h" | 14 #include "base/prefs/pref_change_registrar.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 16 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
17 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" | 17 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" |
| 18 #include "chromeos/ime/input_method_manager.h" |
18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
20 #include "extensions/browser/event_router.h" | 21 #include "extensions/browser/event_router.h" |
21 #include "extensions/browser/extension_system.h" | 22 #include "extensions/browser/extension_system.h" |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 class RenderViewHost; | 25 class RenderViewHost; |
25 } | 26 } |
26 class Profile; | 27 class Profile; |
27 | 28 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 60 |
60 typedef base::CallbackList<void(const AccessibilityStatusEventDetails&)> | 61 typedef base::CallbackList<void(const AccessibilityStatusEventDetails&)> |
61 AccessibilityStatusCallbackList; | 62 AccessibilityStatusCallbackList; |
62 | 63 |
63 typedef AccessibilityStatusCallbackList::Subscription | 64 typedef AccessibilityStatusCallbackList::Subscription |
64 AccessibilityStatusSubscription; | 65 AccessibilityStatusSubscription; |
65 | 66 |
66 // AccessibilityManager changes the statuses of accessibility features | 67 // AccessibilityManager changes the statuses of accessibility features |
67 // watching profile notifications and pref-changes. | 68 // watching profile notifications and pref-changes. |
68 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. | 69 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. |
69 class AccessibilityManager : public content::NotificationObserver, | 70 class AccessibilityManager |
70 extensions::api::braille_display_private::BrailleObserver, | 71 : public content::NotificationObserver, |
71 public ash::SessionStateObserver { | 72 public extensions::api::braille_display_private::BrailleObserver, |
| 73 public input_method::InputMethodManager::Observer, |
| 74 public ash::SessionStateObserver { |
72 public: | 75 public: |
73 // Creates an instance of AccessibilityManager, this should be called once, | 76 // Creates an instance of AccessibilityManager, this should be called once, |
74 // because only one instance should exist at the same time. | 77 // because only one instance should exist at the same time. |
75 static void Initialize(); | 78 static void Initialize(); |
76 // Deletes the existing instance of AccessibilityManager. | 79 // Deletes the existing instance of AccessibilityManager. |
77 static void Shutdown(); | 80 static void Shutdown(); |
78 // Returns the existing instance. If there is no instance, returns NULL. | 81 // Returns the existing instance. If there is no instance, returns NULL. |
79 static AccessibilityManager* Get(); | 82 static AccessibilityManager* Get(); |
80 | 83 |
81 // On a user's first login into a device, any a11y features enabled/disabled | 84 // On a user's first login into a device, any a11y features enabled/disabled |
82 // by the user on the login screen are enabled/disabled in the user's profile. | 85 // by the user on the login screen are enabled/disabled in the user's profile. |
83 // This class watches for profile changes and copies settings into the user's | 86 // This class watches for profile changes and copies settings into the user's |
84 // profile when it detects a login with a newly created profile. | 87 // profile when it detects a login with a newly created profile. |
85 class PrefHandler { | 88 class PrefHandler { |
86 public: | 89 public: |
87 explicit PrefHandler(const char* pref_path); | 90 explicit PrefHandler(const char* pref_path); |
88 virtual ~PrefHandler(); | 91 virtual ~PrefHandler(); |
89 | 92 |
90 // Should be called from AccessibilityManager::SetProfile(). | 93 // Should be called from AccessibilityManager::SetProfile(). |
91 void HandleProfileChanged(Profile* previous_profile, | 94 void HandleProfileChanged(Profile* previous_profile, |
92 Profile* current_profile); | 95 Profile* current_profile); |
93 | 96 |
94 private: | 97 private: |
95 const char* pref_path_; | 98 const char* pref_path_; |
| 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(PrefHandler); |
96 }; | 101 }; |
97 | 102 |
98 // Returns true when the accessibility menu should be shown. | 103 // Returns true when the accessibility menu should be shown. |
99 bool ShouldShowAccessibilityMenu(); | 104 bool ShouldShowAccessibilityMenu(); |
100 | 105 |
101 // Returns true when cursor compositing should be enabled. | 106 // Returns true when cursor compositing should be enabled. |
102 bool ShouldEnableCursorCompositing(); | 107 bool ShouldEnableCursorCompositing(); |
103 | 108 |
104 // Enables or disables the large cursor. | 109 // Enables or disables the large cursor. |
105 void EnableLargeCursor(bool enabled); | 110 void EnableLargeCursor(bool enabled); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 void LocalePrefChanged(); | 203 void LocalePrefChanged(); |
199 | 204 |
200 void CheckBrailleState(); | 205 void CheckBrailleState(); |
201 void ReceiveBrailleDisplayState( | 206 void ReceiveBrailleDisplayState( |
202 scoped_ptr<extensions::api::braille_display_private::DisplayState> state); | 207 scoped_ptr<extensions::api::braille_display_private::DisplayState> state); |
203 | 208 |
204 void SetProfile(Profile* profile); | 209 void SetProfile(Profile* profile); |
205 | 210 |
206 void UpdateChromeOSAccessibilityHistograms(); | 211 void UpdateChromeOSAccessibilityHistograms(); |
207 | 212 |
208 // content::NotificationObserver implementation: | 213 // content::NotificationObserver |
209 virtual void Observe(int type, | 214 virtual void Observe(int type, |
210 const content::NotificationSource& source, | 215 const content::NotificationSource& source, |
211 const content::NotificationDetails& details) OVERRIDE; | 216 const content::NotificationDetails& details) OVERRIDE; |
212 | 217 |
213 // extensions::api::braille_display_private::BrailleObserver implementation. | 218 // extensions::api::braille_display_private::BrailleObserver implementation. |
214 // Enables spoken feedback if a braille display becomes available. | 219 // Enables spoken feedback if a braille display becomes available. |
215 virtual void OnDisplayStateChanged( | 220 virtual void OnDisplayStateChanged( |
216 const extensions::api::braille_display_private::DisplayState& | 221 const extensions::api::braille_display_private::DisplayState& |
217 display_state) OVERRIDE; | 222 display_state) OVERRIDE; |
218 | 223 |
| 224 // InputMethodManager::Observer |
| 225 virtual void InputMethodChanged(input_method::InputMethodManager* manager, |
| 226 bool show_message) OVERRIDE; |
| 227 |
| 228 |
219 // Profile which has the current a11y context. | 229 // Profile which has the current a11y context. |
220 Profile* profile_; | 230 Profile* profile_; |
221 | 231 |
222 // Profile which ChromeVox is currently loaded to. If NULL, ChromeVox is not | 232 // Profile which ChromeVox is currently loaded to. If NULL, ChromeVox is not |
223 // loaded to any profile. | 233 // loaded to any profile. |
224 bool chrome_vox_loaded_on_lock_screen_; | 234 bool chrome_vox_loaded_on_lock_screen_; |
225 bool chrome_vox_loaded_on_user_screen_; | 235 bool chrome_vox_loaded_on_user_screen_; |
226 | 236 |
227 content::NotificationRegistrar notification_registrar_; | 237 content::NotificationRegistrar notification_registrar_; |
228 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; | 238 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
(...skipping 24 matching lines...) Expand all Loading... |
253 bool system_sounds_enabled_; | 263 bool system_sounds_enabled_; |
254 | 264 |
255 AccessibilityStatusCallbackList callback_list_; | 265 AccessibilityStatusCallbackList callback_list_; |
256 | 266 |
257 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); | 267 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); |
258 }; | 268 }; |
259 | 269 |
260 } // namespace chromeos | 270 } // namespace chromeos |
261 | 271 |
262 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 272 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |