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