| 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/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 17 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 17 #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" |
| 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 |
| 28 namespace chromeos { | 29 namespace chromeos { |
| 29 | 30 |
| 30 enum AccessibilityNotificationType { | 31 enum AccessibilityNotificationType { |
| 31 ACCESSIBILITY_MANAGER_SHUTDOWN, | 32 ACCESSIBILITY_MANAGER_SHUTDOWN, |
| 32 ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, | 33 ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE, |
| 33 ACCESSIBILITY_TOGGLE_LARGE_CURSOR, | 34 ACCESSIBILITY_TOGGLE_LARGE_CURSOR, |
| 34 ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER, | 35 ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER, |
| 35 ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK, | 36 ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK, |
| 36 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD | 37 ACCESSIBILITY_TOGGLE_VIRTUAL_KEYBOARD, |
| 38 ACCESSIBILITY_BRAILLE_DISPLAY_CONNECTION_STATE_CHANGED |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 struct AccessibilityStatusEventDetails { | 41 struct AccessibilityStatusEventDetails { |
| 40 AccessibilityStatusEventDetails( | 42 AccessibilityStatusEventDetails( |
| 41 AccessibilityNotificationType notification_type, | 43 AccessibilityNotificationType notification_type, |
| 42 bool enabled, | 44 bool enabled, |
| 43 ash::AccessibilityNotificationVisibility notify); | 45 ash::AccessibilityNotificationVisibility notify); |
| 44 | 46 |
| 45 AccessibilityStatusEventDetails( | 47 AccessibilityStatusEventDetails( |
| 46 AccessibilityNotificationType notification_type, | 48 AccessibilityNotificationType notification_type, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 59 | 61 |
| 60 typedef base::CallbackList<void(const AccessibilityStatusEventDetails&)> | 62 typedef base::CallbackList<void(const AccessibilityStatusEventDetails&)> |
| 61 AccessibilityStatusCallbackList; | 63 AccessibilityStatusCallbackList; |
| 62 | 64 |
| 63 typedef AccessibilityStatusCallbackList::Subscription | 65 typedef AccessibilityStatusCallbackList::Subscription |
| 64 AccessibilityStatusSubscription; | 66 AccessibilityStatusSubscription; |
| 65 | 67 |
| 66 // AccessibilityManager changes the statuses of accessibility features | 68 // AccessibilityManager changes the statuses of accessibility features |
| 67 // watching profile notifications and pref-changes. | 69 // watching profile notifications and pref-changes. |
| 68 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. | 70 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. |
| 69 class AccessibilityManager : public content::NotificationObserver, | 71 class AccessibilityManager |
| 70 extensions::api::braille_display_private::BrailleObserver, | 72 : public content::NotificationObserver, |
| 71 public ash::SessionStateObserver { | 73 public extensions::api::braille_display_private::BrailleObserver, |
| 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 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 void SetAutoclickDelay(int delay_ms); | 145 void SetAutoclickDelay(int delay_ms); |
| 143 | 146 |
| 144 // Returns the autoclick delay in milliseconds. | 147 // Returns the autoclick delay in milliseconds. |
| 145 int GetAutoclickDelay() const; | 148 int GetAutoclickDelay() const; |
| 146 | 149 |
| 147 // Enables or disables the virtual keyboard. | 150 // Enables or disables the virtual keyboard. |
| 148 void EnableVirtualKeyboard(bool enabled); | 151 void EnableVirtualKeyboard(bool enabled); |
| 149 // Returns true if the virtual keyboard is enabled, otherwise false. | 152 // Returns true if the virtual keyboard is enabled, otherwise false. |
| 150 bool IsVirtualKeyboardEnabled(); | 153 bool IsVirtualKeyboardEnabled(); |
| 151 | 154 |
| 155 // Returns true if a braille display is connected to the system, otherwise |
| 156 // false. |
| 157 bool IsBrailleDisplayConnected() const; |
| 158 |
| 152 // SessionStateObserver overrides: | 159 // SessionStateObserver overrides: |
| 153 virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE; | 160 virtual void ActiveUserChanged(const std::string& user_id) OVERRIDE; |
| 154 | 161 |
| 155 void SetProfileForTest(Profile* profile); | 162 void SetProfileForTest(Profile* profile); |
| 156 | 163 |
| 157 static void SetBrailleControllerForTest( | 164 static void SetBrailleControllerForTest( |
| 158 extensions::api::braille_display_private::BrailleController* controller); | 165 extensions::api::braille_display_private::BrailleController* controller); |
| 159 | 166 |
| 160 // Enables/disables system sounds. | 167 // Enables/disables system sounds. |
| 161 void EnableSystemSounds(bool system_sounds_enabled); | 168 void EnableSystemSounds(bool system_sounds_enabled); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 ash::AccessibilityNotificationVisibility spoken_feedback_notification_; | 256 ash::AccessibilityNotificationVisibility spoken_feedback_notification_; |
| 250 | 257 |
| 251 base::WeakPtrFactory<AccessibilityManager> weak_ptr_factory_; | 258 base::WeakPtrFactory<AccessibilityManager> weak_ptr_factory_; |
| 252 | 259 |
| 253 bool should_speak_chrome_vox_announcements_on_user_screen_; | 260 bool should_speak_chrome_vox_announcements_on_user_screen_; |
| 254 | 261 |
| 255 bool system_sounds_enabled_; | 262 bool system_sounds_enabled_; |
| 256 | 263 |
| 257 AccessibilityStatusCallbackList callback_list_; | 264 AccessibilityStatusCallbackList callback_list_; |
| 258 | 265 |
| 266 bool braille_display_connected_; |
| 267 ScopedObserver<extensions::api::braille_display_private::BrailleController, |
| 268 AccessibilityManager> scoped_braille_observer_; |
| 269 |
| 259 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); | 270 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); |
| 260 }; | 271 }; |
| 261 | 272 |
| 262 } // namespace chromeos | 273 } // namespace chromeos |
| 263 | 274 |
| 264 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 275 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |