OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
| 7 |
| 8 #include "ash/shell_delegate.h" |
| 9 #include "base/prefs/pref_change_registrar.h" |
| 10 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" |
| 13 |
| 14 class Profile; |
| 15 |
| 16 namespace content { |
| 17 class WebUI; |
| 18 } |
| 19 |
| 20 namespace chromeos { |
| 21 |
| 22 struct AccessibilityStatusEventDetails { |
| 23 AccessibilityStatusEventDetails( |
| 24 bool enabled, |
| 25 ash::AccessibilityNotificationVisibility notify); |
| 26 |
| 27 AccessibilityStatusEventDetails( |
| 28 bool enabled, |
| 29 ash::MagnifierType magnifier_type, |
| 30 ash::AccessibilityNotificationVisibility notify); |
| 31 |
| 32 bool enabled; |
| 33 ash::MagnifierType magnifier_type; |
| 34 ash::AccessibilityNotificationVisibility notify; |
| 35 }; |
| 36 |
| 37 // AccessibilityManager changes the statuses of accessibility features |
| 38 // watching profile notifications and pref-changes. |
| 39 // TODO(yoshiki): merge MagnificationManager with AccessibilityManager. |
| 40 class AccessibilityManager : public content::NotificationObserver { |
| 41 public: |
| 42 // Creates an instance of AccessibilityManager, this should be called once, |
| 43 // because only one instance should exist at the same time. |
| 44 static void Initialize(); |
| 45 // Deletes the existing instance of AccessibilityManager. |
| 46 static void Shutdown(); |
| 47 // Returns the existing instance. If there is no instance, returns NULL. |
| 48 static AccessibilityManager* Get(); |
| 49 |
| 50 // Enables or disables spoken feedback. Enabling spoken feedback installs the |
| 51 // ChromeVox component extension. If this is being called in a login/oobe |
| 52 // login screen, pass the WebUI object in login_web_ui so that ChromeVox |
| 53 // can be injected directly into that screen, otherwise it should be NULL. |
| 54 void EnableSpokenFeedback(bool enabled, |
| 55 content::WebUI* login_web_ui, |
| 56 ash::AccessibilityNotificationVisibility notify); |
| 57 |
| 58 // Returns true if spoken feedback is enabled, or false if not. |
| 59 bool IsSpokenFeedbackEnabled(); |
| 60 |
| 61 // Toggles whether Chrome OS spoken feedback is on or off. See docs for |
| 62 // EnableSpokenFeedback, above. |
| 63 void ToggleSpokenFeedback(content::WebUI* login_web_ui, |
| 64 ash::AccessibilityNotificationVisibility notify); |
| 65 |
| 66 // Speaks the specified string. |
| 67 void Speak(const std::string& text); |
| 68 |
| 69 // Speaks the given text if the accessibility pref is already set. |
| 70 void MaybeSpeak(const std::string& text); |
| 71 |
| 72 // Enables or disables the high contrast mode for Chrome. |
| 73 void EnableHighContrast(bool enabled); |
| 74 |
| 75 // Returns true if High Contrast is enabled, or false if not. |
| 76 bool IsHighContrastEnabled(); |
| 77 |
| 78 void SetProfileForTest(Profile* profile); |
| 79 |
| 80 protected: |
| 81 AccessibilityManager(); |
| 82 virtual ~AccessibilityManager(); |
| 83 |
| 84 private: |
| 85 void UpdateSpokenFeedbackStatusFromPref(); |
| 86 void UpdateHighContrastStatusFromPref(); |
| 87 |
| 88 void SetProfile(Profile* profile); |
| 89 |
| 90 void UpdateChromeOSAccessibilityHistograms(); |
| 91 |
| 92 // content::NotificationObserver implementation: |
| 93 virtual void Observe(int type, |
| 94 const content::NotificationSource& source, |
| 95 const content::NotificationDetails& details) OVERRIDE; |
| 96 |
| 97 Profile* profile_; |
| 98 content::NotificationRegistrar notification_registrar_; |
| 99 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| 100 |
| 101 bool spoken_feedback_enabled_; |
| 102 bool high_contrast_enabled_; |
| 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); |
| 105 }; |
| 106 |
| 107 } // namespace chromeos |
| 108 |
| 109 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |