| Index: chrome/browser/chromeos/preferences.cc
|
| diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
|
| index 1843c884592cd19046464038314460862bc0c40d..513f90bcaf57f9f6929276f820dd6d3fac4e9fe9 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(
|
| @@ -342,6 +347,16 @@ void Preferences::RegisterProfilePrefs(
|
|
|
| input_method::InputMethodSyncer::RegisterProfilePrefs(registry);
|
|
|
| + std::string current_timezone_id;
|
| + if (chromeos::CrosSettings::IsInitialized()) {
|
| + // In unit tests CrosSettings is not always initialized.
|
| + chromeos::CrosSettings::Get()->GetString(kSystemTimezone,
|
| + ¤t_timezone_id);
|
| + }
|
| + // |current_timezone_id| will be empty if CrosSettings doesn't know the
|
| + // timezone yet.
|
| + registry->RegisterStringPref(prefs::kUserTimezone, current_timezone_id);
|
| +
|
| registry->RegisterBooleanPref(
|
| prefs::kResolveTimezoneByGeolocation, true,
|
| user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
| @@ -419,6 +434,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)
|
| @@ -713,6 +729,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);
|
|
|