| 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 "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
| 11 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 11 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 12 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" | 12 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" |
| 13 #include "chrome/browser/extensions/event_router.h" |
| 14 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 15 | 17 |
| 16 class Profile; | 18 class Profile; |
| 17 | 19 |
| 18 namespace chromeos { | 20 namespace chromeos { |
| 19 | 21 |
| 20 struct AccessibilityStatusEventDetails { | 22 struct AccessibilityStatusEventDetails { |
| 21 AccessibilityStatusEventDetails( | 23 AccessibilityStatusEventDetails( |
| 22 bool enabled, | 24 bool enabled, |
| 23 ash::AccessibilityNotificationVisibility notify); | 25 ash::AccessibilityNotificationVisibility notify); |
| 24 | 26 |
| 25 AccessibilityStatusEventDetails( | 27 AccessibilityStatusEventDetails( |
| 26 bool enabled, | 28 bool enabled, |
| 27 ash::MagnifierType magnifier_type, | 29 ash::MagnifierType magnifier_type, |
| 28 ash::AccessibilityNotificationVisibility notify); | 30 ash::AccessibilityNotificationVisibility notify); |
| 29 | 31 |
| 30 bool enabled; | 32 bool enabled; |
| 31 ash::MagnifierType magnifier_type; | 33 ash::MagnifierType magnifier_type; |
| 32 ash::AccessibilityNotificationVisibility notify; | 34 ash::AccessibilityNotificationVisibility notify; |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 // AccessibilityManager changes the statuses of accessibility features | 37 // AccessibilityManager changes the statuses of accessibility features |
| 36 // watching profile notifications and pref-changes. | 38 // watching profile notifications and pref-changes. |
| 37 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. | 39 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. |
| 38 class AccessibilityManager : public content::NotificationObserver, | 40 class AccessibilityManager : public content::NotificationObserver, |
| 41 public extensions::EventRouter::Observer, |
| 39 extensions::api::braille_display_private::BrailleObserver { | 42 extensions::api::braille_display_private::BrailleObserver { |
| 40 public: | 43 public: |
| 41 // Creates an instance of AccessibilityManager, this should be called once, | 44 // Creates an instance of AccessibilityManager, this should be called once, |
| 42 // because only one instance should exist at the same time. | 45 // because only one instance should exist at the same time. |
| 43 static void Initialize(); | 46 static void Initialize(); |
| 44 // Deletes the existing instance of AccessibilityManager. | 47 // Deletes the existing instance of AccessibilityManager. |
| 45 static void Shutdown(); | 48 static void Shutdown(); |
| 46 // Returns the existing instance. If there is no instance, returns NULL. | 49 // Returns the existing instance. If there is no instance, returns NULL. |
| 47 static AccessibilityManager* Get(); | 50 static AccessibilityManager* Get(); |
| 48 | 51 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 virtual void Observe(int type, | 152 virtual void Observe(int type, |
| 150 const content::NotificationSource& source, | 153 const content::NotificationSource& source, |
| 151 const content::NotificationDetails& details) OVERRIDE; | 154 const content::NotificationDetails& details) OVERRIDE; |
| 152 | 155 |
| 153 // extensions::api::braille_display_private::BrailleObserver implementation. | 156 // extensions::api::braille_display_private::BrailleObserver implementation. |
| 154 // Enables spoken feedback if a braille display becomes available. | 157 // Enables spoken feedback if a braille display becomes available. |
| 155 virtual void OnDisplayStateChanged( | 158 virtual void OnDisplayStateChanged( |
| 156 const extensions::api::braille_display_private::DisplayState& | 159 const extensions::api::braille_display_private::DisplayState& |
| 157 display_state) OVERRIDE; | 160 display_state) OVERRIDE; |
| 158 | 161 |
| 162 // EventRouter::Observer implementation. |
| 163 virtual void OnListenerAdded( |
| 164 const extensions::EventListenerInfo& details) OVERRIDE; |
| 165 virtual void OnListenerRemoved( |
| 166 const extensions::EventListenerInfo& details) OVERRIDE; |
| 167 |
| 159 // Profile which has the current a11y context. | 168 // Profile which has the current a11y context. |
| 160 Profile* profile_; | 169 Profile* profile_; |
| 161 | 170 |
| 162 // Profile which ChromeVox is currently loaded to. If NULL, ChromeVox is not | 171 // Profile which ChromeVox is currently loaded to. If NULL, ChromeVox is not |
| 163 // loaded to any profile. | 172 // loaded to any profile. |
| 164 bool chrome_vox_loaded_on_lock_screen_; | 173 bool chrome_vox_loaded_on_lock_screen_; |
| 165 bool chrome_vox_loaded_on_user_screen_; | 174 bool chrome_vox_loaded_on_user_screen_; |
| 166 | 175 |
| 167 content::NotificationRegistrar notification_registrar_; | 176 content::NotificationRegistrar notification_registrar_; |
| 168 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; | 177 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| 169 scoped_ptr<PrefChangeRegistrar> local_state_pref_change_registrar_; | 178 scoped_ptr<PrefChangeRegistrar> local_state_pref_change_registrar_; |
| 170 | 179 |
| 171 PrefHandler large_cursor_pref_handler_; | 180 PrefHandler large_cursor_pref_handler_; |
| 172 PrefHandler spoken_feedback_pref_handler_; | 181 PrefHandler spoken_feedback_pref_handler_; |
| 173 PrefHandler high_contrast_pref_handler_; | 182 PrefHandler high_contrast_pref_handler_; |
| 174 PrefHandler autoclick_pref_handler_; | 183 PrefHandler autoclick_pref_handler_; |
| 175 PrefHandler autoclick_delay_pref_handler_; | 184 PrefHandler autoclick_delay_pref_handler_; |
| 176 | 185 |
| 177 bool large_cursor_enabled_; | 186 bool large_cursor_enabled_; |
| 178 bool sticky_keys_enabled_; | 187 bool sticky_keys_enabled_; |
| 179 bool spoken_feedback_enabled_; | 188 bool spoken_feedback_enabled_; |
| 180 bool high_contrast_enabled_; | 189 bool high_contrast_enabled_; |
| 181 bool autoclick_enabled_; | 190 bool autoclick_enabled_; |
| 182 int autoclick_delay_ms_; | 191 int autoclick_delay_ms_; |
| 183 | 192 |
| 184 ash::AccessibilityNotificationVisibility spoken_feedback_notification_; | 193 ash::AccessibilityNotificationVisibility spoken_feedback_notification_; |
| 185 | 194 |
| 186 base::WeakPtrFactory<AccessibilityManager> weak_ptr_factory_; | 195 base::WeakPtrFactory<AccessibilityManager> weak_ptr_factory_; |
| 187 | 196 |
| 197 bool should_speak_chrome_vox_announcements_on_user_screen_; |
| 198 |
| 188 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); | 199 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); |
| 189 }; | 200 }; |
| 190 | 201 |
| 191 } // namespace chromeos | 202 } // namespace chromeos |
| 192 | 203 |
| 193 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | 204 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
| OLD | NEW |