OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 Loading... | |
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 printf("*** Initialize\n"); | |
csilv
2011/01/24 18:37:00
Remove printf.
dmazzoni
2011/01/24 18:46:10
Done.
| |
76 PrefService* pref_service = g_browser_process->local_state(); | |
77 bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled); | |
78 FundamentalValue checked(acc_enabled); | |
79 dom_ui_->CallJavascriptFunction( | |
80 L"options.SystemOptions.SetAccessibilityCheckboxState", checked); | |
81 } | |
82 | |
83 void SystemOptionsHandler::RegisterMessages() { | |
84 DCHECK(dom_ui_); | |
85 dom_ui_->RegisterMessageCallback("accessibilityChange", | |
86 NewCallback(this, &SystemOptionsHandler::AccessibilityChangeCallback)); | |
87 } | |
88 | |
89 void SystemOptionsHandler::AccessibilityChangeCallback(const ListValue* args) { | |
90 string16 checkbox_value_str; | |
91 args->GetString(0, &checkbox_value_str); | |
92 bool accessibility_enabled = (checkbox_value_str.size() > 0); | |
93 PrefService* pref_service = g_browser_process->local_state(); | |
94 pref_service->SetBoolean(prefs::kAccessibilityEnabled, accessibility_enabled); | |
95 } | |
OLD | NEW |