Chromium Code Reviews| Index: chrome/browser/chromeos/preferences.cc |
| diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc |
| index 14ec86b2b42664a965fe0e5e656b9d044d7ac1be..ce37e4b5c5ada893dcf192af6f1552e6a569facb 100644 |
| --- a/chrome/browser/chromeos/preferences.cc |
| +++ b/chrome/browser/chromeos/preferences.cc |
| @@ -25,13 +25,17 @@ |
| #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| #include "chrome/browser/chromeos/net/wake_on_wifi_manager.h" |
| #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| +#include "chrome/browser/chromeos/profiles/profile_helper.h" |
| +#include "chrome/browser/chromeos/settings/cros_settings.h" |
| #include "chrome/browser/chromeos/system/input_device_settings.h" |
| #include "chrome/browser/chromeos/system/timezone_resolver_manager.h" |
| +#include "chrome/browser/chromeos/system/timezone_util.h" |
| #include "chrome/browser/download/download_prefs.h" |
| #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| #include "chrome/common/chrome_features.h" |
| #include "chrome/common/pref_names.h" |
| #include "chromeos/chromeos_switches.h" |
| +#include "chromeos/settings/cros_settings_names.h" |
| #include "chromeos/system/devicemode.h" |
| #include "chromeos/system/statistics_provider.h" |
| #include "chromeos/timezone/timezone_resolver.h" |
| @@ -114,6 +118,7 @@ void Preferences::RegisterPrefs(PrefRegistrySimple* registry) { |
| registry->RegisterBooleanPref(prefs::kAccessibilityMonoAudioEnabled, |
| false); |
| registry->RegisterStringPref(prefs::kLogoutStartedLast, std::string()); |
| + registry->RegisterStringPref(prefs::kSigninScreenTimezone, std::string()); |
| registry->RegisterBooleanPref(prefs::kResolveDeviceTimezoneByGeolocation, |
| true); |
| registry->RegisterIntegerPref( |
| @@ -337,6 +342,14 @@ void Preferences::RegisterProfilePrefs( |
| input_method::InputMethodSyncer::RegisterProfilePrefs(registry); |
| + std::string current_timezone_id; |
| + const bool current_timezone_id_valid = |
| + chromeos::CrosSettings::Get()->GetString(kSystemTimezone, |
| + ¤t_timezone_id); |
| + registry->RegisterStringPref(prefs::kUserTimezone, current_timezone_id_valid |
| + ? current_timezone_id |
| + : ""); |
|
stevenjb
2017/05/15 17:08:02
|current_timezone_id_valid| isn't actually necessa
Alexander Alekseev
2017/05/16 01:11:56
Done.
|
| + |
| registry->RegisterBooleanPref( |
| prefs::kResolveTimezoneByGeolocation, true, |
| user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| @@ -414,6 +427,7 @@ void Preferences::InitUserPrefs(sync_preferences::PrefServiceSyncable* prefs) { |
| callback); |
| pref_change_registrar_.Init(prefs); |
| + pref_change_registrar_.Add(prefs::kUserTimezone, callback); |
| pref_change_registrar_.Add(prefs::kResolveTimezoneByGeolocation, callback); |
| pref_change_registrar_.Add(prefs::kUse24HourClock, callback); |
| for (auto* remap_pref : kLanguageRemapPrefs) |
| @@ -708,6 +722,11 @@ void Preferences::ApplyPreferences(ApplyReason reason, |
| static_cast<WakeOnWifiManager::WakeOnWifiFeature>(features)); |
| } |
| + if (pref_name == prefs::kUserTimezone && |
| + reason != REASON_ACTIVE_USER_CHANGED) { |
| + system::UpdateSystemTimezone(ProfileHelper::Get()->GetProfileByUser(user_)); |
| + } |
| + |
| if (pref_name == prefs::kResolveTimezoneByGeolocation && |
| reason != REASON_ACTIVE_USER_CHANGED) { |
| const bool value = prefs_->GetBoolean(prefs::kResolveTimezoneByGeolocation); |