Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3211)

Unified Diff: chrome/browser/chromeos/accessibility/accessibility_manager.h

Issue 14200048: Introduce AcccessibilityManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments & minor fix Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..dbdc45ae6eb9f6a3b3885e4a673579ebde6ab634
--- /dev/null
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager.h
@@ -0,0 +1,111 @@
+// 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);
+
+ AccessibilityStatusEventDetails(
+ bool enabled,
+ ash::MagnifierType magnifier_type,
+ ash::AccessibilityNotificationVisibility 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,
Daniel Erat 2013/04/26 13:58:58 nit: s/,/./
yoshiki 2013/05/24 18:49:45 Done.
+ // 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.
+ // 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.
+ static void Initialize();
+ // Deletes the existing instance of AccessibilityManager.
+ static void Shutdown();
+ // 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
+ 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);
Daniel Erat 2013/04/26 13:58:58 can the parameter names for Speak() and MaybeSpeak
yoshiki 2013/05/24 18:49:45 Done.
+
+ // 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
Daniel Erat 2013/04/26 13:58:58 nit: remove unnecessary comment
yoshiki 2013/05/24 18:49:45 Done.
+ void SetProfileForTest(Profile* profile);
+
+ protected:
+ AccessibilityManager();
+ virtual ~AccessibilityManager();
+
+ private:
+ void UpdateSpokenFeedbackStatusFromPref();
+ void UpdateHighContrastStatusFromPref();
+
+ void SetProfile(Profile* profile);
+
+ void UpdateChromeOSAccessibilityHistograms();
+
+ // content::NotificationObserver implimentation:
Daniel Erat 2013/04/26 13:58:58 nit: s/implimentation/implementation/
yoshiki 2013/05/24 18:49:45 Done.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ Profile* profile_;
+ content::NotificationRegistrar notification_registrar_;
+ 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_

Powered by Google App Engine
This is Rietveld 408576698