Commit ad27dbc9 authored by dmazzoni@chromium.org's avatar dmazzoni@chromium.org

Make the accessibility checkbox affect LocalState rather than the

user's profile.

Review URL: http://codereview.chromium.org/6381007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72397 0039d316-1c4b-4281-b951-d872f2087c98
parent e07c75e4
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 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.
......@@ -11,8 +11,11 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/dom_ui/system_settings_provider.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
......@@ -66,3 +69,26 @@ void SystemOptionsHandler::GetLocalizedValues(
reinterpret_cast<chromeos::SystemSettingsProvider*>(
settings_provider_.get())->GetTimezoneList());
}
void SystemOptionsHandler::Initialize() {
DCHECK(dom_ui_);
PrefService* pref_service = g_browser_process->local_state();
bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled);
FundamentalValue checked(acc_enabled);
dom_ui_->CallJavascriptFunction(
L"options.SystemOptions.SetAccessibilityCheckboxState", checked);
}
void SystemOptionsHandler::RegisterMessages() {
DCHECK(dom_ui_);
dom_ui_->RegisterMessageCallback("accessibilityChange",
NewCallback(this, &SystemOptionsHandler::AccessibilityChangeCallback));
}
void SystemOptionsHandler::AccessibilityChangeCallback(const ListValue* args) {
std::string checked_str;
args->GetString(0, &checked_str);
bool accessibility_enabled = (checked_str == "true");
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kAccessibilityEnabled, accessibility_enabled);
}
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 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.
......@@ -18,6 +18,14 @@ class SystemOptionsHandler : public chromeos::CrosOptionsPageUIHandler {
// OptionsUIHandler implementation.
virtual void GetLocalizedValues(DictionaryValue* localized_strings);
virtual void Initialize();
virtual void RegisterMessages();
// Called when the accessibility checkbox value is changed.
// |args| will contain the checkbox checked state as a string
// ("true" or "false").
void AccessibilityChangeCallback(const ListValue* args);
private:
DISALLOW_COPY_AND_ASSIGN(SystemOptionsHandler);
......
......@@ -55,8 +55,7 @@
<tr>
<td class="option-name">
<label class="checkbox">
<input id="accesibility-check"
pref="settings.accessibility" type="checkbox">
<input id="accesibility-check" type="checkbox">
<span i18n-content="accessibility"></span>
</label>
</td>
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 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.
......@@ -43,9 +43,24 @@ cr.define('options', function() {
$('modifier-keys-button').onclick = function(event) {
OptionsPage.showOverlay('languageCustomizeModifierKeysOverlay');
};
$('accesibility-check').onchange = function(event) {
chrome.send('accessibilityChange',
[String($('accesibility-check').checked)]);
};
}
};
//
// Chrome callbacks
//
/**
* Set the initial state of the accessibility checkbox.
*/
SystemOptions.SetAccessibilityCheckboxState = function(checked) {
$('accesibility-check').checked = checked;
};
// Export
return {
SystemOptions: SystemOptions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment