Large Cursor: Add the large cursor setting UI to chrome://settings.
This patch adds the interface to AccessibilityManager and the setting UI to chrome://settings.
BUG=126942
TEST=Open chrome://settings and the checkbox of the large cursor setting works correctly.
Review URL: https://chromiumcodereview.appspot.com/16063007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204410 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
index f7f473e..ad615be4 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc
+++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc
@@ -155,6 +155,7 @@
}
AccessibilityManager::AccessibilityManager() : profile_(NULL),
+ large_cursor_enabled_(false),
spoken_feedback_enabled_(false),
high_contrast_enabled_(false) {
notification_registrar_.Add(this,
@@ -175,6 +176,28 @@
CHECK(this == g_accessibility_manager);
}
+void AccessibilityManager::EnableLargeCursor(bool enabled) {
+ if (large_cursor_enabled_ == enabled)
+ return;
+
+ large_cursor_enabled_ = enabled;
+
+ if (profile_) {
+ PrefService* pref_service = profile_->GetPrefs();
+ pref_service->SetBoolean(prefs::kLargeCursorEnabled, enabled);
+ pref_service->CommitPendingWrite();
+ }
+
+#if defined(USE_ASH)
+ // Large cursor is implemented only in ash.
+ ash::Shell::GetInstance()->cursor_manager()->SetScale(enabled ? 2.0 : 1.0);
+#endif
+}
+
+bool AccessibilityManager::IsLargeCursorEnabled() {
+ return large_cursor_enabled_;
+}
+
void AccessibilityManager::EnableSpokenFeedback(
bool enabled,
content::WebUI* login_web_ui,
@@ -322,6 +345,16 @@
return high_contrast_enabled_;
}
+void AccessibilityManager::UpdateLargeCursorStatusFromPref() {
+ if (!profile_)
+ return;
+
+ PrefService* pref_service = profile_->GetPrefs();
+ bool large_cursor_enabled =
+ pref_service->GetBoolean(prefs::kLargeCursorEnabled);
+ EnableLargeCursor(large_cursor_enabled);
+}
+
void AccessibilityManager::UpdateSpokenFeedbackStatusFromPref() {
if (!profile_)
return;
@@ -350,6 +383,10 @@
pref_change_registrar_.reset(new PrefChangeRegistrar);
pref_change_registrar_->Init(profile->GetPrefs());
pref_change_registrar_->Add(
+ prefs::kLargeCursorEnabled,
+ base::Bind(&AccessibilityManager::UpdateLargeCursorStatusFromPref,
+ base::Unretained(this)));
+ pref_change_registrar_->Add(
prefs::kSpokenFeedbackEnabled,
base::Bind(&AccessibilityManager::UpdateSpokenFeedbackStatusFromPref,
base::Unretained(this)));
@@ -365,6 +402,7 @@
}
profile_ = profile;
+ UpdateLargeCursorStatusFromPref();
UpdateSpokenFeedbackStatusFromPref();
UpdateHighContrastStatusFromPref();
}