Chromium Code Reviews| Index: chrome/browser/chromeos/accessibility/accessibility_manager.h |
| diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.h b/chrome/browser/chromeos/accessibility/accessibility_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6f3680d8c73ad0bb8faab4d538d74d03284ea213 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/accessibility/accessibility_manager.h |
| @@ -0,0 +1,116 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |
| + |
| +#include "ash/shell_delegate.h" |
| +#include "base/prefs/pref_change_registrar.h" |
| +#include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| + |
| +class Profile; |
| + |
| +namespace content { |
| +class WebUI; |
| +} |
| + |
| +namespace chromeos { |
| + |
| +struct AccessibilityStatusEventDetails { |
| + AccessibilityStatusEventDetails( |
| + bool enabled, ash::AccessibilityNotificationVisibility notify) |
|
Zachary Kuznia
2013/04/24 04:21:03
line break after comma.
yoshiki
2013/04/24 06:00:52
Done.
|
| + : enabled(enabled), |
| + magnifier_type(ash::kDefaultMagnifierType), |
| + notify(notify) {} |
|
Zachary Kuznia
2013/04/24 04:21:03
Don't inline constructors in header files.
yoshiki
2013/04/24 06:00:52
Done.
|
| + |
| + AccessibilityStatusEventDetails( |
| + bool enabled, |
| + ash::MagnifierType magnifier_type, |
| + ash::AccessibilityNotificationVisibility notify) |
| + : enabled(enabled), |
| + magnifier_type(magnifier_type), |
| + notify(notify) {} |
| + |
| + bool enabled; |
| + ash::MagnifierType magnifier_type; |
| + ash::AccessibilityNotificationVisibility notify; |
| +}; |
| + |
| +// AccessibilityManager changes the statuses of accessibility features |
| +// watching profile notifications and pref-changes. |
| +// TODO(yoshiki): merge MagnificationManager with AccessibilityManager. |
| +class AccessibilityManager : public content::NotificationObserver { |
| + public: |
| + // Creates an instance of AccessibilityManager. This should be called once, |
| + // Returns the existing instance. If there is no instance, creates one. |
| + // because only one instance should exist at the same time. |
| + static void Initialize(); |
|
Zachary Kuznia
2013/04/24 04:21:03
What pattern are these statics based on? Why not
yoshiki
2013/04/24 06:00:52
Before, derat@ said that Singleton causes more tro
|
| + // Deletes the existing instance of AccessibilityManager. |
| + static void Shutdown(); |
| + // Returns the existing instance. If there is no instance, returns NULL. |
| + static AccessibilityManager* Get(); |
| + |
| + // Enables or disables spoken feedback. Enabling spoken feedback installs the |
| + // ChromeVox component extension. If this is being called in a login/oobe |
| + // login screen, pass the WebUI object in login_web_ui so that ChromeVox |
| + // can be injected directly into that screen, otherwise it should be NULL. |
| + void EnableSpokenFeedback(bool enabled, |
| + content::WebUI* login_web_ui, |
| + ash::AccessibilityNotificationVisibility notify); |
| + |
| + // Returns true if spoken feedback is enabled, or false if not. |
| + bool IsSpokenFeedbackEnabled(); |
| + |
| + // Toggles whether Chrome OS spoken feedback is on or off. See docs for |
| + // EnableSpokenFeedback, above. |
| + void ToggleSpokenFeedback(content::WebUI* login_web_ui, |
| + ash::AccessibilityNotificationVisibility notify); |
| + |
| + // Speaks the specified string. |
| + void Speak(const std::string& text); |
| + |
| + // Speaks the given text if the accessibility pref is already set. |
| + void MaybeSpeak(const std::string& utterance); |
| + |
| + // Enables or disables the high contrast mode for Chrome. |
| + void EnableHighContrast(bool enabled); |
| + |
| + // Returns true if High Contrast is enabled, or false if not. |
| + bool IsHighContrastEnabled(); |
| + |
| + // For test |
| + void SetProfileForTest(Profile* profile); |
| + |
| + protected: |
| + AccessibilityManager(); |
| + virtual ~AccessibilityManager(); |
| + |
| + private: |
| + void UpdateSpokenFeedbackStatus(); |
| + void UpdateHighContrastStatus(); |
| + |
| + void SetProfile(Profile* profile); |
| + |
| + void UpdateChromeOSAccessibilityHistograms(); |
| + |
| + // content::NotificationObserver implimentation: |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + Profile* profile_; |
| + content::NotificationRegistrar registrar_; |
|
Zachary Kuznia
2013/04/24 04:21:03
you have two registrars, so you should give this a
yoshiki
2013/04/24 06:00:52
Done.
|
| + scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| + |
| + bool spoken_feedback_enabled_; |
| + bool high_contrast_enabled_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AccessibilityManager); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H_ |