Index: chrome/browser/ui/webui/options/browser_options_handler.cc |
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc |
index fa16c8440531907befa2d1d5b15d1bd07a191ce3..ef9fc77ac883ff9880f9a87a421d7fa9aa3f4bc7 100644 |
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc |
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc |
@@ -1013,6 +1013,13 @@ void BrowserOptionsHandler::InitializeHandler() { |
chromeos::kSystemTimezonePolicy, |
base::Bind(&BrowserOptionsHandler::OnSystemTimezonePolicyChanged, |
weak_ptr_factory_.GetWeakPtr())); |
+ local_state_pref_change_registrar_.Init(g_browser_process->local_state()); |
+ local_state_pref_change_registrar_.Add( |
+ prefs::kSystemTimezoneAutomaticDetectionPolicy, |
+ base::Bind(&BrowserOptionsHandler:: |
+ OnSystemTimezoneAutomaticDetectionPolicyChanged, |
+ base::Unretained(this))); |
+ |
#else // !defined(OS_CHROMEOS) |
profile_pref_registrar_.Add( |
proxy_config::prefs::kProxy, |
@@ -1081,6 +1088,7 @@ void BrowserOptionsHandler::InitializePage() { |
profile->IsLegacySupervised()) { |
web_ui()->CallJavascriptFunction("BrowserOptions.hideAndroidAppsSection"); |
} |
+ OnSystemTimezoneAutomaticDetectionPolicyChanged(); |
#endif |
} |
@@ -1440,6 +1448,22 @@ void BrowserOptionsHandler::OnSystemTimezonePolicyChanged() { |
"BrowserOptions.setSystemTimezoneManaged", |
base::FundamentalValue(chromeos::system::HasSystemTimezonePolicy())); |
} |
+ |
+void BrowserOptionsHandler::OnSystemTimezoneAutomaticDetectionPolicyChanged() { |
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ chromeos::switches::kEnableSystemTimezoneAutomaticDetectionPolicy)) { |
+ return; |
+ } |
+ |
+ PrefService* prefs = g_browser_process->local_state(); |
+ const bool is_managed = prefs->IsManagedPreference( |
+ prefs::kSystemTimezoneAutomaticDetectionPolicy); |
+ const int value = |
+ prefs->GetInteger(prefs::kSystemTimezoneAutomaticDetectionPolicy); |
+ web_ui()->CallJavascriptFunction( |
+ "BrowserOptions.setSystemTimezoneAutomaticDetectionManaged", |
+ base::FundamentalValue(is_managed), base::FundamentalValue(value)); |
+} |
#endif |
scoped_ptr<base::DictionaryValue> |