Commit d99f60d9 authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

Chrome OS: New users on CfM devices default to static time zone.

CfM devices default to static time zone. To expand this into user sessions,
new users created on Chrome OS devices will default to static time zone.

Otherwise static time zone was limited to signin screen only, which is not
what was usually needed.

Bug: 1018720
Change-Id: I977119e41238f29434b3a742b950ff7edb87ff03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2030001
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737144}
parent 2be8c028
......@@ -357,10 +357,22 @@ void Preferences::RegisterProfilePrefs(
prefs::kResolveTimezoneByGeolocationMigratedToMethod, false,
user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PREF);
bool allow_time_zone_resolve_by_default = true;
// CfM devices default to static timezone unless time zone resolving is
// explicitly enabled for the signin screen (usually by policy).
if (system::InputDeviceSettings::Get()->ForceKeyboardDrivenUINavigation() &&
!system::TimeZoneResolverManager::
IfServiceShouldBeRunningForSigninScreen()) {
allow_time_zone_resolve_by_default = false;
}
registry->RegisterIntegerPref(
prefs::kResolveTimezoneByGeolocationMethod,
static_cast<int>(
system::TimeZoneResolverManager::TimeZoneResolveMethod::IP_ONLY),
allow_time_zone_resolve_by_default
? system::TimeZoneResolverManager::TimeZoneResolveMethod::IP_ONLY
: system::TimeZoneResolverManager::TimeZoneResolveMethod::
DISABLED),
user_prefs::PrefRegistrySyncable::SYNCABLE_OS_PREF);
registry->RegisterBooleanPref(prefs::kCaptivePortalAuthenticationIgnoresProxy,
......
......@@ -9,6 +9,8 @@
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
#include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
#include "chromeos/system/statistics_provider.h"
#include "chromeos/tpm/install_attributes.h"
#include "components/prefs/pref_service.h"
namespace chromeos {
namespace system {
......@@ -272,8 +274,21 @@ void MouseSettings::Apply(const MouseSettings& mouse_settings,
// static
bool InputDeviceSettings::ForceKeyboardDrivenUINavigation() {
// tests do not have InstallAttributes or LocalState initialized, so getting
// browser_policy_connector crashes.
if (!InstallAttributes::IsInitialized() ||
!g_browser_process->local_state() ||
g_browser_process->local_state()
->GetAllPrefStoresInitializationStatus() ==
PrefService::INITIALIZATION_STATUS_WAITING) {
return false;
}
policy::BrowserPolicyConnectorChromeOS* connector =
g_browser_process->platform_part()->browser_policy_connector_chromeos();
InstallAttributes::IsInitialized()
? g_browser_process->platform_part()
->browser_policy_connector_chromeos()
: nullptr;
if (!connector)
return false;
......
......@@ -310,5 +310,10 @@ bool TimeZoneResolverManager::IsTimeZoneResolutionPolicyControlled() {
return GetServiceConfigurationFromPolicy() != UNSPECIFIED;
}
// static
bool TimeZoneResolverManager::IfServiceShouldBeRunningForSigninScreen() {
return GetServiceConfigurationForSigninScreen() == SHOULD_START;
}
} // namespace system
} // namespace chromeos
......@@ -80,6 +80,9 @@ class TimeZoneResolverManager : public TimeZoneResolver::Delegate {
// thus cannot be changed by user.
static bool IsTimeZoneResolutionPolicyControlled();
// Returns true if service should be running for the signin screen.
static bool IfServiceShouldBeRunningForSigninScreen();
private:
int GetTimezoneManagementSetting();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment