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/chromeos/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/chromeos/cros/cros_library.h" | 14 #include "chrome/browser/chromeos/cros/cros_library.h" |
15 #include "chrome/browser/chromeos/cros/power_library.h" | 15 #include "chrome/browser/chromeos/cros/power_library.h" |
16 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 16 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
17 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 17 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
18 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 18 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
19 #include "chrome/browser/chromeos/login/login_utils.h" | 19 #include "chrome/browser/chromeos/login/login_utils.h" |
20 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | |
21 #include "chrome/browser/chromeos/system/touchpad_settings.h" | 20 #include "chrome/browser/chromeos/system/touchpad_settings.h" |
22 #include "chrome/browser/prefs/pref_member.h" | 21 #include "chrome/browser/prefs/pref_member.h" |
23 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
24 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 23 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
25 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
26 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
28 #include "content/common/notification_details.h" | 27 #include "content/common/notification_details.h" |
29 #include "content/common/notification_source.h" | 28 #include "content/common/notification_source.h" |
| 29 #include "googleurl/src/gurl.h" |
30 #include "unicode/timezone.h" | 30 #include "unicode/timezone.h" |
31 | 31 |
32 namespace chromeos { | 32 namespace chromeos { |
33 | 33 |
34 static const char kFallbackInputMethodLocale[] = "en-US"; | 34 static const char kFallbackInputMethodLocale[] = "en-US"; |
35 | 35 |
36 Preferences::Preferences() {} | 36 Preferences::Preferences() {} |
37 | 37 |
38 Preferences::~Preferences() {} | 38 Preferences::~Preferences() {} |
39 | 39 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 prefs::kLanguageXkbRemapAltKeyTo, prefs, this); | 268 prefs::kLanguageXkbRemapAltKeyTo, prefs, this); |
269 language_xkb_auto_repeat_enabled_.Init( | 269 language_xkb_auto_repeat_enabled_.Init( |
270 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); | 270 prefs::kLanguageXkbAutoRepeatEnabled, prefs, this); |
271 language_xkb_auto_repeat_delay_pref_.Init( | 271 language_xkb_auto_repeat_delay_pref_.Init( |
272 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); | 272 prefs::kLanguageXkbAutoRepeatDelay, prefs, this); |
273 language_xkb_auto_repeat_interval_pref_.Init( | 273 language_xkb_auto_repeat_interval_pref_.Init( |
274 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); | 274 prefs::kLanguageXkbAutoRepeatInterval, prefs, this); |
275 | 275 |
276 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); | 276 enable_screen_lock_.Init(prefs::kEnableScreenLock, prefs, this); |
277 | 277 |
278 use_shared_proxies_.Init(prefs::kUseSharedProxies, prefs, this); | |
279 | |
280 // Initialize preferences to currently saved state. | 278 // Initialize preferences to currently saved state. |
281 NotifyPrefChanged(NULL); | 279 NotifyPrefChanged(NULL); |
282 | 280 |
283 // Initialize virtual keyboard settings to currently saved state. | 281 // Initialize virtual keyboard settings to currently saved state. |
284 UpdateVirturalKeyboardPreference(prefs); | 282 UpdateVirturalKeyboardPreference(prefs); |
285 | 283 |
286 // If a guest is logged in, initialize the prefs as if this is the first | 284 // If a guest is logged in, initialize the prefs as if this is the first |
287 // login. | 285 // login. |
288 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { | 286 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
289 LoginUtils::Get()->SetFirstLoginPrefs(prefs); | 287 LoginUtils::Get()->SetFirstLoginPrefs(prefs); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 language_prefs::kMozcIntegerPrefs[i].ibus_config_name, | 457 language_prefs::kMozcIntegerPrefs[i].ibus_config_name, |
460 language_mozc_integer_prefs_[i].GetValue()); | 458 language_mozc_integer_prefs_[i].GetValue()); |
461 } | 459 } |
462 } | 460 } |
463 | 461 |
464 // Init or update power manager config. | 462 // Init or update power manager config. |
465 if (!pref_name || *pref_name == prefs::kEnableScreenLock) { | 463 if (!pref_name || *pref_name == prefs::kEnableScreenLock) { |
466 CrosLibrary::Get()->GetPowerLibrary()->EnableScreenLock( | 464 CrosLibrary::Get()->GetPowerLibrary()->EnableScreenLock( |
467 enable_screen_lock_.GetValue()); | 465 enable_screen_lock_.GetValue()); |
468 } | 466 } |
469 | |
470 if (!pref_name || *pref_name == prefs::kUseSharedProxies) { | |
471 g_browser_process->chromeos_proxy_config_service_impl()-> | |
472 UISetUseSharedProxies(use_shared_proxies_.GetValue()); | |
473 } | |
474 } | 467 } |
475 | 468 |
476 void Preferences::SetLanguageConfigBoolean(const char* section, | 469 void Preferences::SetLanguageConfigBoolean(const char* section, |
477 const char* name, | 470 const char* name, |
478 bool value) { | 471 bool value) { |
479 input_method::ImeConfigValue config; | 472 input_method::ImeConfigValue config; |
480 config.type = input_method::ImeConfigValue::kValueTypeBool; | 473 config.type = input_method::ImeConfigValue::kValueTypeBool; |
481 config.bool_value = value; | 474 config.bool_value = value; |
482 input_method::InputMethodManager::GetInstance()-> | 475 input_method::InputMethodManager::GetInstance()-> |
483 SetImeConfig(section, name, config); | 476 SetImeConfig(section, name, config); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 591 |
599 // Remove invalid prefs. | 592 // Remove invalid prefs. |
600 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); | 593 DictionaryPrefUpdate updater(prefs, prefs::kLanguagePreferredVirtualKeyboard); |
601 DictionaryValue* pref_value = updater.Get(); | 594 DictionaryValue* pref_value = updater.Get(); |
602 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { | 595 for (size_t i = 0; i < layouts_to_remove.size(); ++i) { |
603 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); | 596 pref_value->RemoveWithoutPathExpansion(layouts_to_remove[i], NULL); |
604 } | 597 } |
605 } | 598 } |
606 | 599 |
607 } // namespace chromeos | 600 } // namespace chromeos |
OLD | NEW |