Chromium Code Reviews| 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, | |
|
Daniel Erat
2013/04/26 13:58:58
nit: s/,/./
yoshiki
2013/05/24 18:49:45
Done.
| |
| 43 // Returns the existing instance. If there is no instance, creates one. | |
|
Daniel Erat
2013/04/26 13:58:58
this doesn't look like it returns anything
yoshiki
2013/05/24 18:49:45
Done. Fixed the comment.
| |
| 44 // because only one instance should exist at the same time. | |
|
Daniel Erat
2013/04/26 13:58:58
i don't understand the "if there is no instance" n
yoshiki
2013/05/24 18:49:45
You're right. The comment was wrong. Fixed.
| |
| 45 static void Initialize(); | |
| 46 // Deletes the existing instance of AccessibilityManager. | |
| 47 static void Shutdown(); | |
| 48 // Returns the existing instance. If there is no instance, returns NULL. | |
|
Daniel Erat
2013/04/26 13:58:58
this comment is wrong -- it crashes if there's no
yoshiki
2013/05/24 18:49:45
Changed the implementation to match with the comme
| |
| 49 static AccessibilityManager* Get(); | |
| 50 | |
| 51 // Enables or disables spoken feedback. Enabling spoken feedback installs the | |
| 52 // ChromeVox component extension. If this is being called in a login/oobe | |
| 53 // login screen, pass the WebUI object in login_web_ui so that ChromeVox | |
| 54 // can be injected directly into that screen, otherwise it should be NULL. | |
| 55 void EnableSpokenFeedback(bool enabled, | |
| 56 content::WebUI* login_web_ui, | |
| 57 ash::AccessibilityNotificationVisibility notify); | |
| 58 | |
| 59 // Returns true if spoken feedback is enabled, or false if not. | |
| 60 bool IsSpokenFeedbackEnabled(); | |
| 61 | |
| 62 // Toggles whether Chrome OS spoken feedback is on or off. See docs for | |
| 63 // EnableSpokenFeedback, above. | |
| 64 void ToggleSpokenFeedback(content::WebUI* login_web_ui, | |
| 65 ash::AccessibilityNotificationVisibility notify); | |
| 66 | |
| 67 // Speaks the specified string. | |
| 68 void Speak(const std::string& text); | |
| 69 | |
| 70 // Speaks the given text if the accessibility pref is already set. | |
| 71 void MaybeSpeak(const std::string& utterance); | |
|
Daniel Erat
2013/04/26 13:58:58
can the parameter names for Speak() and MaybeSpeak
yoshiki
2013/05/24 18:49:45
Done.
| |
| 72 | |
| 73 // Enables or disables the high contrast mode for Chrome. | |
| 74 void EnableHighContrast(bool enabled); | |
| 75 | |
| 76 // Returns true if High Contrast is enabled, or false if not. | |
| 77 bool IsHighContrastEnabled(); | |
| 78 | |
| 79 // For test | |
|
Daniel Erat
2013/04/26 13:58:58
nit: remove unnecessary comment
yoshiki
2013/05/24 18:49:45
Done.
| |
| 80 void SetProfileForTest(Profile* profile); | |
| 81 | |
| 82 protected: | |
| 83 AccessibilityManager(); | |
| 84 virtual ~AccessibilityManager(); | |
| 85 | |
| 86 private: | |
| 87 void UpdateSpokenFeedbackStatusFromPref(); | |
| 88 void UpdateHighContrastStatusFromPref(); | |
| 89 | |
| 90 void SetProfile(Profile* profile); | |
| 91 | |
| 92 void UpdateChromeOSAccessibilityHistograms(); | |
| 93 | |
| 94 // content::NotificationObserver implimentation: | |
|
Daniel Erat
2013/04/26 13:58:58
nit: s/implimentation/implementation/
yoshiki
2013/05/24 18:49:45
Done.
| |
| 95 virtual void Observe(int type, | |
| 96 const content::NotificationSource& source, | |
| 97 const content::NotificationDetails& details) OVERRIDE; | |
| 98 | |
| 99 Profile* profile_; | |
| 100 content::NotificationRegistrar notification_registrar_; | |
| 101 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; | |
| 102 | |
| 103 bool spoken_feedback_enabled_; | |
| 104 bool high_contrast_enabled_; | |
| 105 | |
| 106 DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); | |
| 107 }; | |
| 108 | |
| 109 } // namespace chromeos | |
| 110 | |
| 111 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ | |
| OLD | NEW |