Chromium Code Reviews| 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_; |
| 96 }; | 99 }; |
|
oshima
2014/03/10 22:11:08
DISALLOW_COPY_AND_ASSIGN unless it's designed to b
Zachary Kuznia
2014/03/11 21:01:02
Done.
| |
| 97 | 100 |
| 98 // Returns true when the accessibility menu should be shown. | 101 // Returns true when the accessibility menu should be shown. |
| 99 bool ShouldShowAccessibilityMenu(); | 102 bool ShouldShowAccessibilityMenu(); |
| 100 | 103 |
| 101 // Returns true when cursor compositing should be enabled. | 104 // Returns true when cursor compositing should be enabled. |
| 102 bool ShouldEnableCursorCompositing(); | 105 bool ShouldEnableCursorCompositing(); |
| 103 | 106 |
| 104 // Enables or disables the large cursor. | 107 // Enables or disables the large cursor. |
| 105 void EnableLargeCursor(bool enabled); | 108 void EnableLargeCursor(bool enabled); |
| 106 // Returns true if the large cursor is enabled, or false if not. | 109 // Returns true if the large cursor is enabled, or false if not. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 virtual void Observe(int type, | 212 virtual void Observe(int type, |
| 210 const content::NotificationSource& source, | 213 const content::NotificationSource& source, |
| 211 const content::NotificationDetails& details) OVERRIDE; | 214 const content::NotificationDetails& details) OVERRIDE; |
| 212 | 215 |
| 213 // extensions::api::braille_display_private::BrailleObserver implementation. | 216 // extensions::api::braille_display_private::BrailleObserver implementation. |
| 214 // Enables spoken feedback if a braille display becomes available. | 217 // Enables spoken feedback if a braille display becomes available. |
| 215 virtual void OnDisplayStateChanged( | 218 virtual void OnDisplayStateChanged( |
| 216 const extensions::api::braille_display_private::DisplayState& | 219 const extensions::api::braille_display_private::DisplayState& |
| 217 display_state) OVERRIDE; | 220 display_state) OVERRIDE; |
| 218 | 221 |
| 222 // Overridden from InputMethodManager::Observer. | |
|
oshima
2014/03/10 22:11:08
nit: You can now just say
// InputMethodManager::
Zachary Kuznia
2014/03/11 21:01:02
Done.
| |
| 223 virtual void InputMethodChanged(input_method::InputMethodManager* manager, | |
| 224 bool show_message) OVERRIDE; | |
| 225 | |
| 226 | |
| 219 // Profile which has the current a11y context. | 227 // Profile which has the current a11y context. |
| 220 Profile* profile_; | 228 Profile* profile_; |
| 221 | 229 |
| 222 // Profile which ChromeVox is currently loaded to. If NULL, ChromeVox is not | 230 // Profile which ChromeVox is currently loaded to. If NULL, ChromeVox is not |
| 223 // loaded to any profile. | 231 // loaded to any profile. |
| 224 bool chrome_vox_loaded_on_lock_screen_; | 232 bool chrome_vox_loaded_on_lock_screen_; |
| 225 bool chrome_vox_loaded_on_user_screen_; | 233 bool chrome_vox_loaded_on_user_screen_; |
| 226 | 234 |
| 227 content::NotificationRegistrar notification_registrar_; | 235 content::NotificationRegistrar notification_registrar_; |
| 228 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; | 236 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 253 bool system_sounds_enabled_; | 261 bool system_sounds_enabled_; |
| 254 | 262 |
| 255 AccessibilityStatusCallbackList callback_list_; | 263 AccessibilityStatusCallbackList callback_list_; |
| 256 | 264 |
| 257 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); | 265 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); |
| 258 }; | 266 }; |
| 259 | 267 |
| 260 } // namespace chromeos | 268 } // namespace chromeos |
| 261 | 269 |
| 262 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 270 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |