| OLD | NEW |
| 1 // Copyright (c) 2011 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/ui/webui/options/chromeos/system_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/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/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
| 17 #include "content/common/json_value_serializer.h" | 17 #include "content/common/json_value_serializer.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chromeos/accessibility_util.h" | 19 #include "chrome/browser/chromeos/accessibility_util.h" |
| 20 #include "chrome/browser/chromeos/cros_settings.h" |
| 20 #include "chrome/browser/chromeos/language_preferences.h" | 21 #include "chrome/browser/chromeos/language_preferences.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/prefs/pref_service.h" | 23 #include "chrome/browser/prefs/pref_service.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/webui/options/chromeos/system_settings_provider.h" | 25 #include "chrome/browser/ui/webui/options/chromeos/system_settings_provider.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "chrome/common/extensions/extension.h" | 28 #include "chrome/common/extensions/extension.h" |
| 28 #include "grit/browser_resources.h" | 29 #include "grit/browser_resources.h" |
| 29 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
| 30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 31 #include "grit/locale_settings.h" | 32 #include "grit/locale_settings.h" |
| 32 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
| 33 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 34 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
| 35 | 36 |
| 36 SystemOptionsHandler::SystemOptionsHandler() | 37 SystemOptionsHandler::SystemOptionsHandler() { |
| 37 : chromeos::CrosOptionsPageUIHandler( | |
| 38 new chromeos::SystemSettingsProvider()) { | |
| 39 } | 38 } |
| 40 | 39 |
| 41 SystemOptionsHandler::~SystemOptionsHandler() { | 40 SystemOptionsHandler::~SystemOptionsHandler() { |
| 42 } | 41 } |
| 43 | 42 |
| 44 void SystemOptionsHandler::GetLocalizedValues( | 43 void SystemOptionsHandler::GetLocalizedValues( |
| 45 DictionaryValue* localized_strings) { | 44 DictionaryValue* localized_strings) { |
| 46 DCHECK(localized_strings); | 45 DCHECK(localized_strings); |
| 47 | 46 |
| 48 RegisterTitle(localized_strings, "systemPage", IDS_OPTIONS_SYSTEM_TAB_LABEL); | 47 RegisterTitle(localized_strings, "systemPage", IDS_OPTIONS_SYSTEM_TAB_LABEL); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 l10n_util::GetStringUTF16( | 82 l10n_util::GetStringUTF16( |
| 84 IDS_OPTIONS_SETTINGS_LANGUAGES_MODIFIER_KEYS_CUSTOMIZE)); | 83 IDS_OPTIONS_SETTINGS_LANGUAGES_MODIFIER_KEYS_CUSTOMIZE)); |
| 85 | 84 |
| 86 localized_strings->SetString("accessibilityTitle", | 85 localized_strings->SetString("accessibilityTitle", |
| 87 l10n_util::GetStringUTF16( | 86 l10n_util::GetStringUTF16( |
| 88 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); | 87 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); |
| 89 localized_strings->SetString("accessibility", | 88 localized_strings->SetString("accessibility", |
| 90 l10n_util::GetStringUTF16( | 89 l10n_util::GetStringUTF16( |
| 91 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); | 90 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); |
| 92 | 91 |
| 92 // TODO(pastarmovj): replace this with a call to the CrosSettings list |
| 93 // handling functionality to come. |
| 93 localized_strings->Set("timezoneList", | 94 localized_strings->Set("timezoneList", |
| 94 reinterpret_cast<chromeos::SystemSettingsProvider*>( | 95 static_cast<chromeos::SystemSettingsProvider*>( |
| 95 settings_provider_.get())->GetTimezoneList()); | 96 chromeos::CrosSettings::Get()->GetProvider( |
| 97 chromeos::kSystemTimezone))->GetTimezoneList()); |
| 96 } | 98 } |
| 97 | 99 |
| 98 void SystemOptionsHandler::Initialize() { | 100 void SystemOptionsHandler::Initialize() { |
| 99 DCHECK(web_ui_); | 101 DCHECK(web_ui_); |
| 100 PrefService* pref_service = g_browser_process->local_state(); | 102 PrefService* pref_service = g_browser_process->local_state(); |
| 101 bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled); | 103 bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled); |
| 102 base::FundamentalValue checked(acc_enabled); | 104 base::FundamentalValue checked(acc_enabled); |
| 103 web_ui_->CallJavascriptFunction( | 105 web_ui_->CallJavascriptFunction( |
| 104 "options.SystemOptions.SetAccessibilityCheckboxState", checked); | 106 "options.SystemOptions.SetAccessibilityCheckboxState", checked); |
| 105 | 107 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 120 base::Unretained(this))); | 122 base::Unretained(this))); |
| 121 } | 123 } |
| 122 | 124 |
| 123 void SystemOptionsHandler::AccessibilityChangeCallback(const ListValue* args) { | 125 void SystemOptionsHandler::AccessibilityChangeCallback(const ListValue* args) { |
| 124 std::string checked_str; | 126 std::string checked_str; |
| 125 args->GetString(0, &checked_str); | 127 args->GetString(0, &checked_str); |
| 126 bool accessibility_enabled = (checked_str == "true"); | 128 bool accessibility_enabled = (checked_str == "true"); |
| 127 | 129 |
| 128 chromeos::accessibility::EnableAccessibility(accessibility_enabled, NULL); | 130 chromeos::accessibility::EnableAccessibility(accessibility_enabled, NULL); |
| 129 } | 131 } |
| OLD | NEW |