| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/autoclick/autoclick_controller.h" | 9 #include "ash/autoclick/autoclick_controller.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 21 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 21 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 22 #include "chrome/browser/chromeos/drive/file_system_util.h" | 22 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 23 #include "chrome/browser/chromeos/input_method/input_method_syncer.h" | 23 #include "chrome/browser/chromeos/input_method/input_method_syncer.h" |
| 24 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 24 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 25 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" | 25 #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" |
| 26 #include "chrome/browser/chromeos/system/input_device_settings.h" | 26 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 27 #include "chrome/browser/chromeos/system/timezone_resolver_manager.h" |
| 27 #include "chrome/browser/download/download_prefs.h" | 28 #include "chrome/browser/download/download_prefs.h" |
| 28 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 29 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 29 #include "chrome/common/chrome_features.h" | 30 #include "chrome/common/chrome_features.h" |
| 30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 31 #include "chromeos/chromeos_switches.h" | 32 #include "chromeos/chromeos_switches.h" |
| 32 #include "chromeos/system/statistics_provider.h" | 33 #include "chromeos/system/statistics_provider.h" |
| 33 #include "chromeos/timezone/timezone_resolver.h" | 34 #include "chromeos/timezone/timezone_resolver.h" |
| 34 #include "components/drive/drive_pref_names.h" | 35 #include "components/drive/drive_pref_names.h" |
| 35 #include "components/feedback/tracing_manager.h" | 36 #include "components/feedback/tracing_manager.h" |
| 36 #include "components/pref_registry/pref_registry_syncable.h" | 37 #include "components/pref_registry/pref_registry_syncable.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 89 |
| 89 // static | 90 // static |
| 90 void Preferences::RegisterPrefs(PrefRegistrySimple* registry) { | 91 void Preferences::RegisterPrefs(PrefRegistrySimple* registry) { |
| 91 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); | 92 registry->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); |
| 92 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); | 93 registry->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); |
| 93 registry->RegisterBooleanPref(prefs::kAccessibilityVirtualKeyboardEnabled, | 94 registry->RegisterBooleanPref(prefs::kAccessibilityVirtualKeyboardEnabled, |
| 94 false); | 95 false); |
| 95 registry->RegisterStringPref(prefs::kLogoutStartedLast, std::string()); | 96 registry->RegisterStringPref(prefs::kLogoutStartedLast, std::string()); |
| 96 registry->RegisterBooleanPref(prefs::kResolveDeviceTimezoneByGeolocation, | 97 registry->RegisterBooleanPref(prefs::kResolveDeviceTimezoneByGeolocation, |
| 97 true); | 98 true); |
| 99 registry->RegisterIntegerPref( |
| 100 prefs::kSystemTimezoneAutomaticDetectionPolicy, |
| 101 ResolveDeviceTimezoneByGeolocationPolicyValues::USERS_DECIDE); |
| 98 } | 102 } |
| 99 | 103 |
| 100 // static | 104 // static |
| 101 void Preferences::RegisterProfilePrefs( | 105 void Preferences::RegisterProfilePrefs( |
| 102 user_prefs::PrefRegistrySyncable* registry) { | 106 user_prefs::PrefRegistrySyncable* registry) { |
| 103 std::string hardware_keyboard_id; | 107 std::string hardware_keyboard_id; |
| 104 // TODO(yusukes): Remove the runtime hack. | 108 // TODO(yusukes): Remove the runtime hack. |
| 105 if (base::SysInfo::IsRunningOnChromeOS()) { | 109 if (base::SysInfo::IsRunningOnChromeOS()) { |
| 106 DCHECK(g_browser_process); | 110 DCHECK(g_browser_process); |
| 107 PrefService* local_state = g_browser_process->local_state(); | 111 PrefService* local_state = g_browser_process->local_state(); |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 637 } |
| 634 | 638 |
| 635 if (pref_name == prefs::kResolveTimezoneByGeolocation && | 639 if (pref_name == prefs::kResolveTimezoneByGeolocation && |
| 636 reason != REASON_ACTIVE_USER_CHANGED) { | 640 reason != REASON_ACTIVE_USER_CHANGED) { |
| 637 const bool value = prefs_->GetBoolean(prefs::kResolveTimezoneByGeolocation); | 641 const bool value = prefs_->GetBoolean(prefs::kResolveTimezoneByGeolocation); |
| 638 if (user_is_owner) { | 642 if (user_is_owner) { |
| 639 g_browser_process->local_state()->SetBoolean( | 643 g_browser_process->local_state()->SetBoolean( |
| 640 prefs::kResolveDeviceTimezoneByGeolocation, value); | 644 prefs::kResolveDeviceTimezoneByGeolocation, value); |
| 641 } | 645 } |
| 642 if (user_is_primary_) { | 646 if (user_is_primary_) { |
| 643 if (value) { | 647 system::TimeZoneResolverManager* manager = |
| 644 g_browser_process->platform_part()->GetTimezoneResolver()->Start(); | 648 g_browser_process->platform_part()->GetTimezoneResolverManager(); |
| 645 } else { | 649 manager->SetPrimaryUserPrefs(prefs_); |
| 646 g_browser_process->platform_part()->GetTimezoneResolver()->Stop(); | 650 manager->UpdateTimezoneResolver(); |
| 647 if (reason == REASON_PREF_CHANGED) { | 651 if (!value && reason == REASON_PREF_CHANGED) { |
| 648 // Allow immediate timezone update on Stop + Start. | 652 // Allow immediate timezone update on Stop + Start. |
| 649 g_browser_process->local_state()->ClearPref( | 653 g_browser_process->local_state()->ClearPref( |
| 650 TimeZoneResolver::kLastTimeZoneRefreshTime); | 654 TimeZoneResolver::kLastTimeZoneRefreshTime); |
| 651 } | |
| 652 } | 655 } |
| 653 } | 656 } |
| 654 } | 657 } |
| 655 | 658 |
| 656 if (pref_name == prefs::kUse24HourClock || | 659 if (pref_name == prefs::kUse24HourClock || |
| 657 reason != REASON_ACTIVE_USER_CHANGED) { | 660 reason != REASON_ACTIVE_USER_CHANGED) { |
| 658 const bool value = prefs_->GetBoolean(prefs::kUse24HourClock); | 661 const bool value = prefs_->GetBoolean(prefs::kUse24HourClock); |
| 659 user_manager::known_user::SetBooleanPref(user_->GetAccountId(), | 662 user_manager::known_user::SetBooleanPref(user_->GetAccountId(), |
| 660 prefs::kUse24HourClock, value); | 663 prefs::kUse24HourClock, value); |
| 661 } | 664 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 touch_hud_projection_enabled_.SetValue(enabled); | 748 touch_hud_projection_enabled_.SetValue(enabled); |
| 746 } | 749 } |
| 747 | 750 |
| 748 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { | 751 void Preferences::ActiveUserChanged(const user_manager::User* active_user) { |
| 749 if (active_user != user_) | 752 if (active_user != user_) |
| 750 return; | 753 return; |
| 751 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); | 754 ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); |
| 752 } | 755 } |
| 753 | 756 |
| 754 } // namespace chromeos | 757 } // namespace chromeos |
| OLD | NEW |