diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-05 03:13:09 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-05 03:13:09 +0000 |
commit | 487ba146b8f27e123863ac28070ec675690772c6 (patch) | |
tree | 5ed0a423ec0acc1c8f89fd08530e105d328bbedf | |
parent | 5647895bce1ebfe89fa0367078cf0b09cedb25c2 (diff) | |
download | chromium_src-487ba146b8f27e123863ac28070ec675690772c6.zip chromium_src-487ba146b8f27e123863ac28070ec675690772c6.tar.gz chromium_src-487ba146b8f27e123863ac28070ec675690772c6.tar.bz2 |
Add stubs to options menu for additional accessibility features
R=dmazzoni@chromium.org
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8932002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116447 0039d316-1c4b-4281-b951-d872f2087c98
15 files changed, 371 insertions, 60 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 6c929d8..fc8a9ed 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -12172,8 +12172,17 @@ changed since last sign in <message name="IDS_OPTIONS_SETTINGS_BLUETOOTH_REMOTE_PASSKEY_REQUEST" desc="Bluetooth pairing message typically displayed when pairing a wireless keyboard. The label %1 is replaced with the name of the device."> Please enter this passkey on "<ph name="DEVICE_NAME">%1<ex>Nexus S</ex></ph>": </message> - <message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION" desc="In the settings tab, the text next to the checkbox for accessbility."> - Enable accessibility features + <message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION" desc="In the settings tab, the text next to the checkbox for spoken feedback."> + Enable spoken feedback + </message> + <message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_HIGH_CONTRAST_DESCRIPTION" desc="In the settings tab, the text next to the checkbox for high contrast mode."> + Enable high contrast mode + </message> + <message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_DESCRIPTION" desc="In the settings tab, the text next to the checkbox for screen magnifier."> + Enable screen magnifier + </message> + <message name="IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION" desc="In the settings tab, the text next to the checkbox for virtual keyboard."> + Enable virtual keyboard </message> <message name="IDS_OPTIONS_SETTINGS_KEYBOARD_LAYOUT_TEXT" desc="In the settings tab, the text of the keyboard layout label."> Keyboard Layout: diff --git a/chrome/browser/chromeos/accessibility/accessibility_util.cc b/chrome/browser/chromeos/accessibility/accessibility_util.cc index db66dc4..dd3e233 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_util.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -153,6 +153,24 @@ void EnableAccessibility(bool enabled, WebUI* login_web_ui) { } } +void EnableHighContrast(bool enabled) { + PrefService* pref_service = g_browser_process->local_state(); + pref_service->SetBoolean(prefs::kHighContrastEnabled, enabled); + pref_service->ScheduleSavePersistentPrefs(); +} + +void EnableScreenMagnifier(bool enabled) { + PrefService* pref_service = g_browser_process->local_state(); + pref_service->SetBoolean(prefs::kScreenMagnifierEnabled, enabled); + pref_service->ScheduleSavePersistentPrefs(); +} + +void EnableVirtualKeyboard(bool enabled) { + PrefService* pref_service = g_browser_process->local_state(); + pref_service->SetBoolean(prefs::kVirtualKeyboardEnabled, enabled); + pref_service->ScheduleSavePersistentPrefs(); +} + void ToggleAccessibility(WebUI* login_web_ui) { bool accessibility_enabled = g_browser_process && g_browser_process->local_state()->GetBoolean( diff --git a/chrome/browser/chromeos/accessibility/accessibility_util.h b/chrome/browser/chromeos/accessibility/accessibility_util.h index c25b78e..63cc333 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_util.h +++ b/chrome/browser/chromeos/accessibility/accessibility_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -17,6 +17,15 @@ namespace accessibility { // can be injected directly into that screen, otherwise it should be NULL. void EnableAccessibility(bool enabled, WebUI* login_web_ui); +// Enable or disable the high contrast mode for Chrome. +void EnableHighContrast(bool enabled); + +// Enable or disable the screen magnifier. +void EnableScreenMagnifier(bool enabled); + +// Enable or disable the virtual keyboard. +void EnableVirtualKeyboard(bool enabled); + // Toggles whether Chrome OS accessibility is on or off. See docs for // EnableAccessibility, above. void ToggleAccessibility(WebUI* login_web_ui); diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 35a134e..f0b4dd6 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -357,6 +357,21 @@ void WizardController::RegisterPrefs(PrefService* local_state) { false, PrefService::UNSYNCABLE_PREF); } + if (local_state->FindPreference(prefs::kHighContrastEnabled) == NULL) { + local_state->RegisterBooleanPref(prefs::kHighContrastEnabled, + false, + PrefService::UNSYNCABLE_PREF); + } + if (local_state->FindPreference(prefs::kScreenMagnifierEnabled) == NULL) { + local_state->RegisterBooleanPref(prefs::kScreenMagnifierEnabled, + false, + PrefService::UNSYNCABLE_PREF); + } + if (local_state->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { + local_state->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, + false, + PrefService::UNSYNCABLE_PREF); + } } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc index cee3141..ec63d33 100644 --- a/chrome/browser/chromeos/preferences.cc +++ b/chrome/browser/chromeos/preferences.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -61,6 +61,21 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) { false, PrefService::UNSYNCABLE_PREF); } + if (prefs->FindPreference(prefs::kHighContrastEnabled) == NULL) { + prefs->RegisterBooleanPref(prefs::kHighContrastEnabled, + false, + PrefService::UNSYNCABLE_PREF); + } + if (prefs->FindPreference(prefs::kScreenMagnifierEnabled) == NULL) { + prefs->RegisterBooleanPref(prefs::kScreenMagnifierEnabled, + false, + PrefService::UNSYNCABLE_PREF); + } + if (prefs->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { + prefs->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, + false, + PrefService::UNSYNCABLE_PREF); + } prefs->RegisterIntegerPref(prefs::kTouchpadSensitivity, 3, PrefService::UNSYNCABLE_PREF); diff --git a/chrome/browser/resources/options/chromeos/system_options.html b/chrome/browser/resources/options/chromeos/system_options.html index 97baec7..5769aa5 100644 --- a/chrome/browser/resources/options/chromeos/system_options.html +++ b/chrome/browser/resources/options/chromeos/system_options.html @@ -107,8 +107,32 @@ <div class="option-name"> <div class="checkbox"> <label> - <input id="accesibility-check" type="checkbox"> - <span i18n-content="accessibility"></span> + <input id="accessibility-spoken-feedback-check" type="checkbox"> + <span i18n-content="accessibilitySpokenFeedback"></span> + </label> + </div> + </div> + <div class="option-name"> + <div class="checkbox"> + <label> + <input id="accessibility-high-contrast-check" type="checkbox"> + <span i18n-content="accessibilityHighContrast"></span> + </label> + </div> + </div> + <div class="option-name"> + <div class="checkbox"> + <label> + <input id="accessibility-screen-magnifier-check" type="checkbox"> + <span i18n-content="accessibilityScreenMagnifier"></span> + </label> + </div> + </div> + <div class="option-name"> + <div class="checkbox"> + <label> + <input id="accessibility-virtual-keyboard-check" type="checkbox"> + <span i18n-content="accessibilityVirtualKeyboard"></span> </label> </div> </div> diff --git a/chrome/browser/resources/options/chromeos/system_options.js b/chrome/browser/resources/options/chromeos/system_options.js index ae26b9c..a0940f8 100644 --- a/chrome/browser/resources/options/chromeos/system_options.js +++ b/chrome/browser/resources/options/chromeos/system_options.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -68,9 +68,21 @@ cr.define('options', function() { $('modifier-keys-button').onclick = function(event) { OptionsPage.navigateToPage('languageCustomizeModifierKeysOverlay'); }; - $('accesibility-check').onchange = function(event) { - chrome.send('accessibilityChange', - [String($('accesibility-check').checked)]); + $('accessibility-spoken-feedback-check').onchange = function(event) { + chrome.send('spokenFeedbackChange', + [$('accessibility-spoken-feedback-check').checked]); + }; + $('accessibility-high-contrast-check').onchange = function(event) { + chrome.send('highContrastChange', + [$('accessibility-high-contrast-check').checked]); + }; + $('accessibility-screen-magnifier-check').onchange = function(event) { + chrome.send('screenMagnifierChange', + [$('accessibility-screen-magnifier-check').checked]); + }; + $('accessibility-virtual-keyboard-check').onchange = function(event) { + chrome.send('virtualKeyboardChange', + [$('accessibility-virtual-keyboard-check').checked]); }; initializeBrightnessButton_('brightness-decrease-button', 'decreaseScreenBrightness'); @@ -111,10 +123,31 @@ cr.define('options', function() { // /** - * Set the initial state of the accessibility checkbox. + * Set the initial state of the spoken feedback checkbox. + */ + SystemOptions.setSpokenFeedbackCheckboxState = function(checked) { + $('accessibility-spoken-feedback-check').checked = checked; + }; + + /** + * Set the initial state of the high contrast checkbox. + */ + SystemOptions.setHighContrastCheckboxState = function(checked) { + $('accessibility-high-contrast-check').checked = checked; + }; + + /** + * Set the initial state of the screen magnifier checkbox. + */ + SystemOptions.setScreenMagnifierCheckboxState = function(checked) { + $('accessibility-screen-magnifier-check').checked = checked; + }; + + /** + * Set the initial state of the virtual keyboard checkbox. */ - SystemOptions.SetAccessibilityCheckboxState = function(checked) { - $('accesibility-check').checked = checked; + SystemOptions.setVirtualKeyboardCheckboxState = function(checked) { + $('accessibility-virtual-keyboard-check').checked = checked; }; /** diff --git a/chrome/browser/resources/options2/chromeos/system_options.html b/chrome/browser/resources/options2/chromeos/system_options.html index 97baec7..5769aa5 100644 --- a/chrome/browser/resources/options2/chromeos/system_options.html +++ b/chrome/browser/resources/options2/chromeos/system_options.html @@ -107,8 +107,32 @@ <div class="option-name"> <div class="checkbox"> <label> - <input id="accesibility-check" type="checkbox"> - <span i18n-content="accessibility"></span> + <input id="accessibility-spoken-feedback-check" type="checkbox"> + <span i18n-content="accessibilitySpokenFeedback"></span> + </label> + </div> + </div> + <div class="option-name"> + <div class="checkbox"> + <label> + <input id="accessibility-high-contrast-check" type="checkbox"> + <span i18n-content="accessibilityHighContrast"></span> + </label> + </div> + </div> + <div class="option-name"> + <div class="checkbox"> + <label> + <input id="accessibility-screen-magnifier-check" type="checkbox"> + <span i18n-content="accessibilityScreenMagnifier"></span> + </label> + </div> + </div> + <div class="option-name"> + <div class="checkbox"> + <label> + <input id="accessibility-virtual-keyboard-check" type="checkbox"> + <span i18n-content="accessibilityVirtualKeyboard"></span> </label> </div> </div> diff --git a/chrome/browser/resources/options2/chromeos/system_options.js b/chrome/browser/resources/options2/chromeos/system_options.js index ae26b9c..a0940f8 100644 --- a/chrome/browser/resources/options2/chromeos/system_options.js +++ b/chrome/browser/resources/options2/chromeos/system_options.js @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -68,9 +68,21 @@ cr.define('options', function() { $('modifier-keys-button').onclick = function(event) { OptionsPage.navigateToPage('languageCustomizeModifierKeysOverlay'); }; - $('accesibility-check').onchange = function(event) { - chrome.send('accessibilityChange', - [String($('accesibility-check').checked)]); + $('accessibility-spoken-feedback-check').onchange = function(event) { + chrome.send('spokenFeedbackChange', + [$('accessibility-spoken-feedback-check').checked]); + }; + $('accessibility-high-contrast-check').onchange = function(event) { + chrome.send('highContrastChange', + [$('accessibility-high-contrast-check').checked]); + }; + $('accessibility-screen-magnifier-check').onchange = function(event) { + chrome.send('screenMagnifierChange', + [$('accessibility-screen-magnifier-check').checked]); + }; + $('accessibility-virtual-keyboard-check').onchange = function(event) { + chrome.send('virtualKeyboardChange', + [$('accessibility-virtual-keyboard-check').checked]); }; initializeBrightnessButton_('brightness-decrease-button', 'decreaseScreenBrightness'); @@ -111,10 +123,31 @@ cr.define('options', function() { // /** - * Set the initial state of the accessibility checkbox. + * Set the initial state of the spoken feedback checkbox. + */ + SystemOptions.setSpokenFeedbackCheckboxState = function(checked) { + $('accessibility-spoken-feedback-check').checked = checked; + }; + + /** + * Set the initial state of the high contrast checkbox. + */ + SystemOptions.setHighContrastCheckboxState = function(checked) { + $('accessibility-high-contrast-check').checked = checked; + }; + + /** + * Set the initial state of the screen magnifier checkbox. + */ + SystemOptions.setScreenMagnifierCheckboxState = function(checked) { + $('accessibility-screen-magnifier-check').checked = checked; + }; + + /** + * Set the initial state of the virtual keyboard checkbox. */ - SystemOptions.SetAccessibilityCheckboxState = function(checked) { - $('accesibility-check').checked = checked; + SystemOptions.setVirtualKeyboardCheckboxState = function(checked) { + $('accessibility-virtual-keyboard-check').checked = checked; }; /** diff --git a/chrome/browser/ui/webui/options/chromeos/system_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/system_options_handler.cc index ebc781a..fbe9523 100644 --- a/chrome/browser/ui/webui/options/chromeos/system_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/system_options_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -114,9 +114,18 @@ void SystemOptionsHandler::GetLocalizedValues( localized_strings->SetString("accessibilityTitle", l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); - localized_strings->SetString("accessibility", + localized_strings->SetString("accessibilitySpokenFeedback", l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); + localized_strings->SetString("accessibilityHighContrast", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_ACCESSIBILITY_HIGH_CONTRAST_DESCRIPTION)); + localized_strings->SetString("accessibilityScreenMagnifier", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_DESCRIPTION)); + localized_strings->SetString("accessibilityVirtualKeyboard", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION)); // TODO(pastarmovj): replace this with a call to the CrosSettings list // handling functionality to come. @@ -128,10 +137,22 @@ void SystemOptionsHandler::GetLocalizedValues( void SystemOptionsHandler::Initialize() { PrefService* pref_service = g_browser_process->local_state(); - bool acc_enabled = pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled); - base::FundamentalValue checked(acc_enabled); + bool enabled = pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled); + web_ui()->CallJavascriptFunction( + "options.SystemOptions.setSpokenFeedbackCheckboxState", + base::FundamentalValue(enabled)); + enabled = pref_service->GetBoolean(prefs::kHighContrastEnabled); + web_ui()->CallJavascriptFunction( + "options.SystemOptions.setHighContrastCheckboxState", + base::FundamentalValue(enabled)); + enabled = pref_service->GetBoolean(prefs::kScreenMagnifierEnabled); web_ui()->CallJavascriptFunction( - "options.SystemOptions.SetAccessibilityCheckboxState", checked); + "options.SystemOptions.setScreenMagnifierCheckboxState", + base::FundamentalValue(enabled)); + enabled = pref_service->GetBoolean(prefs::kVirtualKeyboardEnabled); + web_ui()->CallJavascriptFunction( + "options.SystemOptions.setVirtualKeyboardCheckboxState", + base::FundamentalValue(enabled)); chromeos::XInputHierarchyChangedEventListener::GetInstance() ->AddObserver(this); @@ -167,14 +188,29 @@ void SystemOptionsHandler::MouseExists(bool* exists) { } void SystemOptionsHandler::RegisterMessages() { - web_ui()->RegisterMessageCallback("accessibilityChange", - base::Bind(&SystemOptionsHandler::AccessibilityChangeCallback, + web_ui()->RegisterMessageCallback( + "spokenFeedbackChange", + base::Bind(&SystemOptionsHandler::SpokenFeedbackChangeCallback, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "highContrastChange", + base::Bind(&SystemOptionsHandler::HighContrastChangeCallback, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "screenMagnifierChange", + base::Bind(&SystemOptionsHandler::ScreenMagnifierChangeCallback, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "virtualKeyboardChange", + base::Bind(&SystemOptionsHandler::VirtualKeyboardChangeCallback, base::Unretained(this))); - web_ui()->RegisterMessageCallback("decreaseScreenBrightness", + web_ui()->RegisterMessageCallback( + "decreaseScreenBrightness", base::Bind(&SystemOptionsHandler::DecreaseScreenBrightnessCallback, base::Unretained(this))); - web_ui()->RegisterMessageCallback("increaseScreenBrightness", + web_ui()->RegisterMessageCallback( + "increaseScreenBrightness", base::Bind(&SystemOptionsHandler::IncreaseScreenBrightnessCallback, base::Unretained(this))); } @@ -184,12 +220,34 @@ void SystemOptionsHandler::DeviceHierarchyChanged() { CheckTouchpadExists(); } -void SystemOptionsHandler::AccessibilityChangeCallback(const ListValue* args) { - std::string checked_str; - args->GetString(0, &checked_str); - bool accessibility_enabled = (checked_str == "true"); +void SystemOptionsHandler::SpokenFeedbackChangeCallback(const ListValue* args) { + bool enabled = false; + args->GetBoolean(0, &enabled); + + chromeos::accessibility::EnableAccessibility(enabled, NULL); +} + +void SystemOptionsHandler::HighContrastChangeCallback(const ListValue* args) { + bool enabled = false; + args->GetBoolean(0, &enabled); + + chromeos::accessibility::EnableHighContrast(enabled); +} + +void SystemOptionsHandler::ScreenMagnifierChangeCallback( + const ListValue* args) { + bool enabled = false; + args->GetBoolean(0, &enabled); + + chromeos::accessibility::EnableScreenMagnifier(enabled); +} + +void SystemOptionsHandler::VirtualKeyboardChangeCallback( + const ListValue* args) { + bool enabled = false; + args->GetBoolean(0, &enabled); - chromeos::accessibility::EnableAccessibility(accessibility_enabled, NULL); + chromeos::accessibility::EnableVirtualKeyboard(enabled); } void SystemOptionsHandler::DecreaseScreenBrightnessCallback( diff --git a/chrome/browser/ui/webui/options/chromeos/system_options_handler.h b/chrome/browser/ui/webui/options/chromeos/system_options_handler.h index 812fb68..a8bfd93 100644 --- a/chrome/browser/ui/webui/options/chromeos/system_options_handler.h +++ b/chrome/browser/ui/webui/options/chromeos/system_options_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -34,10 +34,13 @@ class SystemOptionsHandler // DeviceHierarchyObserver implementation. virtual void DeviceHierarchyChanged() OVERRIDE; - // Called when the accessibility checkbox value is changed. + // Called when the accessibility checkbox values are changed. // |args| will contain the checkbox checked state as a string // ("true" or "false"). - void AccessibilityChangeCallback(const base::ListValue* args); + void SpokenFeedbackChangeCallback(const base::ListValue* args); + void HighContrastChangeCallback(const base::ListValue* args); + void ScreenMagnifierChangeCallback(const base::ListValue* args); + void VirtualKeyboardChangeCallback(const base::ListValue* args); // Called when the System configuration screen is used to adjust // the screen brightness. diff --git a/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc b/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc index 4dbc9b0c..cc03600 100644 --- a/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -116,9 +116,18 @@ void SystemOptionsHandler::GetLocalizedValues( localized_strings->SetString("accessibilityTitle", l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); - localized_strings->SetString("accessibility", + localized_strings->SetString("accessibilitySpokenFeedback", l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); + localized_strings->SetString("accessibilityHighContrast", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_ACCESSIBILITY_HIGH_CONTRAST_DESCRIPTION)); + localized_strings->SetString("accessibilityScreenMagnifier", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_ACCESSIBILITY_SCREEN_MAGNIFIER_DESCRIPTION)); + localized_strings->SetString("accessibilityVirtualKeyboard", + l10n_util::GetStringUTF16( + IDS_OPTIONS_SETTINGS_ACCESSIBILITY_VIRTUAL_KEYBOARD_DESCRIPTION)); // TODO(pastarmovj): replace this with a call to the CrosSettings list // handling functionality to come. @@ -130,10 +139,22 @@ void SystemOptionsHandler::GetLocalizedValues( void SystemOptionsHandler::Initialize() { PrefService* pref_service = g_browser_process->local_state(); - bool acc_enabled = pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled); - base::FundamentalValue checked(acc_enabled); + bool enabled = pref_service->GetBoolean(prefs::kSpokenFeedbackEnabled); + web_ui()->CallJavascriptFunction( + "options.SystemOptions.setSpokenFeedbackCheckboxState", + base::FundamentalValue(enabled)); + enabled = pref_service->GetBoolean(prefs::kHighContrastEnabled); + web_ui()->CallJavascriptFunction( + "options.SystemOptions.setHighContrastCheckboxState", + base::FundamentalValue(enabled)); + enabled = pref_service->GetBoolean(prefs::kScreenMagnifierEnabled); web_ui()->CallJavascriptFunction( - "options.SystemOptions.SetAccessibilityCheckboxState", checked); + "options.SystemOptions.setScreenMagnifierCheckboxState", + base::FundamentalValue(enabled)); + enabled = pref_service->GetBoolean(prefs::kVirtualKeyboardEnabled); + web_ui()->CallJavascriptFunction( + "options.SystemOptions.setVirtualKeyboardCheckboxState", + base::FundamentalValue(enabled)); chromeos::XInputHierarchyChangedEventListener::GetInstance() ->AddObserver(this); @@ -169,14 +190,29 @@ void SystemOptionsHandler::MouseExists(bool* exists) { } void SystemOptionsHandler::RegisterMessages() { - web_ui()->RegisterMessageCallback("accessibilityChange", - base::Bind(&SystemOptionsHandler::AccessibilityChangeCallback, + web_ui()->RegisterMessageCallback( + "spokenFeedbackChange", + base::Bind(&SystemOptionsHandler::SpokenFeedbackChangeCallback, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "highContrastChange", + base::Bind(&SystemOptionsHandler::HighContrastChangeCallback, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "screenMagnifierChange", + base::Bind(&SystemOptionsHandler::ScreenMagnifierChangeCallback, + base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "virtualKeyboardChange", + base::Bind(&SystemOptionsHandler::VirtualKeyboardChangeCallback, base::Unretained(this))); - web_ui()->RegisterMessageCallback("decreaseScreenBrightness", + web_ui()->RegisterMessageCallback( + "decreaseScreenBrightness", base::Bind(&SystemOptionsHandler::DecreaseScreenBrightnessCallback, base::Unretained(this))); - web_ui()->RegisterMessageCallback("increaseScreenBrightness", + web_ui()->RegisterMessageCallback( + "increaseScreenBrightness", base::Bind(&SystemOptionsHandler::IncreaseScreenBrightnessCallback, base::Unretained(this))); } @@ -186,12 +222,34 @@ void SystemOptionsHandler::DeviceHierarchyChanged() { CheckTouchpadExists(); } -void SystemOptionsHandler::AccessibilityChangeCallback(const ListValue* args) { - std::string checked_str; - args->GetString(0, &checked_str); - bool accessibility_enabled = (checked_str == "true"); +void SystemOptionsHandler::SpokenFeedbackChangeCallback(const ListValue* args) { + bool enabled = false; + args->GetBoolean(0, &enabled); + + chromeos::accessibility::EnableAccessibility(enabled, NULL); +} + +void SystemOptionsHandler::HighContrastChangeCallback(const ListValue* args) { + bool enabled = false; + args->GetBoolean(0, &enabled); + + chromeos::accessibility::EnableHighContrast(enabled); +} + +void SystemOptionsHandler::ScreenMagnifierChangeCallback( + const ListValue* args) { + bool enabled = false; + args->GetBoolean(0, &enabled); + + chromeos::accessibility::EnableScreenMagnifier(enabled); +} + +void SystemOptionsHandler::VirtualKeyboardChangeCallback( + const ListValue* args) { + bool enabled = false; + args->GetBoolean(0, &enabled); - chromeos::accessibility::EnableAccessibility(accessibility_enabled, NULL); + chromeos::accessibility::EnableVirtualKeyboard(enabled); } void SystemOptionsHandler::DecreaseScreenBrightnessCallback( diff --git a/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.h b/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.h index 7fb3a52..4a6552e 100644 --- a/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.h +++ b/chrome/browser/ui/webui/options2/chromeos/system_options_handler2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -36,10 +36,13 @@ class SystemOptionsHandler // DeviceHierarchyObserver implementation. virtual void DeviceHierarchyChanged() OVERRIDE; - // Called when the accessibility checkbox value is changed. + // Called when the accessibility checkbox values are changed. // |args| will contain the checkbox checked state as a string // ("true" or "false"). - void AccessibilityChangeCallback(const base::ListValue* args); + void SpokenFeedbackChangeCallback(const base::ListValue* args); + void HighContrastChangeCallback(const base::ListValue* args); + void ScreenMagnifierChangeCallback(const base::ListValue* args); + void VirtualKeyboardChangeCallback(const base::ListValue* args); // Called when the System configuration screen is used to adjust // the screen brightness. diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 89e31f5..38cac80 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -609,6 +609,12 @@ const char kLanguagePreferredVirtualKeyboard[] = // A boolean pref which determines whether spoken feedback is enabled. const char kSpokenFeedbackEnabled[] = "settings.accessibility"; +// A boolean pref which determines whether high conrast is enabled. +const char kHighContrastEnabled[] = "settings.a11y.high_contrast"; +// A boolean pref which determines whether screen magnifier is enabled. +const char kScreenMagnifierEnabled[] = "settings.a11y.screen_magnifier"; +// A boolean pref which determines whether virtual keyboard is enabled. +const char kVirtualKeyboardEnabled[] = "settings.a11y.virtual_keyboard"; // A boolean pref which turns on Advanced Filesystem // (USB support, SD card, etc). diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 35d6452..22bdd87 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -223,6 +223,9 @@ extern const char kLanguageXkbAutoRepeatDelay[]; extern const char kLanguageXkbAutoRepeatInterval[]; extern const char kLanguagePreferredVirtualKeyboard[]; extern const char kSpokenFeedbackEnabled[]; +extern const char kHighContrastEnabled[]; +extern const char kScreenMagnifierEnabled[]; +extern const char kVirtualKeyboardEnabled[]; extern const char kLabsAdvancedFilesystemEnabled[]; extern const char kLabsMediaplayerEnabled[]; extern const char kEnableScreenLock[]; |