| 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/json/json_value_serializer.h" | 13 #include "base/json/json_value_serializer.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 l10n_util::GetStringUTF16( | 88 l10n_util::GetStringUTF16( |
| 90 IDS_OPTIONS_SETTINGS_LANGUAGES_MODIFIER_KEYS_CUSTOMIZE)); | 89 IDS_OPTIONS_SETTINGS_LANGUAGES_MODIFIER_KEYS_CUSTOMIZE)); |
| 91 | 90 |
| 92 localized_strings->SetString("accessibilityTitle", | 91 localized_strings->SetString("accessibilityTitle", |
| 93 l10n_util::GetStringUTF16( | 92 l10n_util::GetStringUTF16( |
| 94 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); | 93 IDS_OPTIONS_SETTINGS_SECTION_TITLE_ACCESSIBILITY)); |
| 95 localized_strings->SetString("accessibility", | 94 localized_strings->SetString("accessibility", |
| 96 l10n_util::GetStringUTF16( | 95 l10n_util::GetStringUTF16( |
| 97 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); | 96 IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)); |
| 98 | 97 |
| 98 // TODO(pastarmovj): replace this with a call to the CrosSettings list |
| 99 // handling functionality to come. |
| 99 localized_strings->Set("timezoneList", | 100 localized_strings->Set("timezoneList", |
| 100 reinterpret_cast<chromeos::SystemSettingsProvider*>( | 101 static_cast<chromeos::SystemSettingsProvider*>( |
| 101 settings_provider_.get())->GetTimezoneList()); | 102 chromeos::CrosSettings::Get()->GetProvider( |
| 103 chromeos::kSystemTimezone))->GetTimezoneList()); |
| 102 } | 104 } |
| 103 | 105 |
| 104 void SystemOptionsHandler::Initialize() { | 106 void SystemOptionsHandler::Initialize() { |
| 105 DCHECK(web_ui_); | 107 DCHECK(web_ui_); |
| 106 PrefService* pref_service = g_browser_process->local_state(); | 108 PrefService* pref_service = g_browser_process->local_state(); |
| 107 bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled); | 109 bool acc_enabled = pref_service->GetBoolean(prefs::kAccessibilityEnabled); |
| 108 base::FundamentalValue checked(acc_enabled); | 110 base::FundamentalValue checked(acc_enabled); |
| 109 web_ui_->CallJavascriptFunction( | 111 web_ui_->CallJavascriptFunction( |
| 110 "options.SystemOptions.SetAccessibilityCheckboxState", checked); | 112 "options.SystemOptions.SetAccessibilityCheckboxState", checked); |
| 111 | 113 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 device.SetString("deviceName", data[3*i]); | 175 device.SetString("deviceName", data[3*i]); |
| 174 device.SetString("deviceId", data[3*i+1]); | 176 device.SetString("deviceId", data[3*i+1]); |
| 175 device.SetString("deviceType", data[3*i+2]); | 177 device.SetString("deviceType", data[3*i+2]); |
| 176 device.SetString("deviceStatus", "bluetoothDeviceNotPaired"); | 178 device.SetString("deviceStatus", "bluetoothDeviceNotPaired"); |
| 177 web_ui_->CallJavascriptFunction( | 179 web_ui_->CallJavascriptFunction( |
| 178 "options.SystemOptions.addBluetoothDevice", device); | 180 "options.SystemOptions.addBluetoothDevice", device); |
| 179 } | 181 } |
| 180 web_ui_->CallJavascriptFunction( | 182 web_ui_->CallJavascriptFunction( |
| 181 "options.SystemOptions.notifyBluetoothSearchComplete"); | 183 "options.SystemOptions.notifyBluetoothSearchComplete"); |
| 182 } | 184 } |
| OLD | NEW |