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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/dom_ui/system_options_handler.h" 5 #include "chrome/browser/chromeos/dom_ui/system_options_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/chromeos/dom_ui/system_settings_provider.h" 15 #include "chrome/browser/chromeos/dom_ui/system_settings_provider.h"
15 #include "chrome/browser/chromeos/language_preferences.h" 16 #include "chrome/browser/chromeos/language_preferences.h"
17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/common/pref_names.h"
16 #include "grit/browser_resources.h" 19 #include "grit/browser_resources.h"
17 #include "grit/chromium_strings.h" 20 #include "grit/chromium_strings.h"
18 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
19 #include "grit/locale_settings.h" 22 #include "grit/locale_settings.h"
20 #include "grit/theme_resources.h" 23 #include "grit/theme_resources.h"
21 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
22 25
23 SystemOptionsHandler::SystemOptionsHandler() 26 SystemOptionsHandler::SystemOptionsHandler()
24 : chromeos::CrosOptionsPageUIHandler( 27 : chromeos::CrosOptionsPageUIHandler(
25 new chromeos::SystemSettingsProvider()) { 28 new chromeos::SystemSettingsProvider()) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 l10n_util::GetStringUTF16( 62 l10n_util::GetStringUTF16(
60 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); 63 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY));
61 localized_strings->SetString("accessibility", 64 localized_strings->SetString("accessibility",
62 l10n_util::GetStringUTF16( 65 l10n_util::GetStringUTF16(
63 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); 66 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION));
64 67
65 localized_strings->Set("timezoneList", 68 localized_strings->Set("timezoneList",
66 reinterpret_cast<chromeos::SystemSettingsProvider*>( 69 reinterpret_cast<chromeos::SystemSettingsProvider*>(
67 settings_provider_.get())->GetTimezoneList()); 70 settings_provider_.get())->GetTimezoneList());
68 } 71 }
72
73 void SystemOptionsHandler::Initialize() {
74 DCHECK(dom_ui_);
75 PrefService* pref_service = g_browser_process->local_state();
76 bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled);
77 FundamentalValue checked(acc_enabled);
78 dom_ui_->CallJavascriptFunction(
79 L"options.SystemOptions.SetAccessibilityCheckboxState", checked);
80 }
81
82 void SystemOptionsHandler::RegisterMessages() {
83 DCHECK(dom_ui_);
84 dom_ui_->RegisterMessageCallback("accessibilityChange",
85 NewCallback(this, &SystemOptionsHandler::AccessibilityChangeCallback));
86 }
87
88 void SystemOptionsHandler::AccessibilityChangeCallback(const ListValue* args) {
89 std::string checked_str;
90 args->GetString(0, &checked_str);
91 bool accessibility_enabled = (checked_str == "true");
92 PrefService* pref_service = g_browser_process->local_state();
93 pref_service->SetBoolean(prefs::kAccessibilityEnabled, accessibility_enabled);
94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698