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

Unified Diff: chrome/browser/chromeos/dom_ui/system_options_handler.cc

Issue 6381007: Make the accessibility checkbox affect LocalState rather than the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/dom_ui/system_options_handler.cc
===================================================================
--- chrome/browser/chromeos/dom_ui/system_options_handler.cc (revision 72316)
+++ chrome/browser/chromeos/dom_ui/system_options_handler.cc (working copy)
@@ -1,4 +1,4 @@
-// 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 @@
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);
+}

Powered by Google App Engine
This is Rietveld 408576698