Chromium Code Reviews| Index: chrome/browser/policy/browser_policy_connector.cc |
| diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc |
| index 2874a911dd55d483b43354fedfc3b51ff9cfd511..4eaadbf3434acd9f27f1d8067f7de6c91226fce9 100644 |
| --- a/chrome/browser/policy/browser_policy_connector.cc |
| +++ b/chrome/browser/policy/browser_policy_connector.cc |
| @@ -9,7 +9,11 @@ |
| #include "base/command_line.h" |
| #include "base/file_path.h" |
| #include "base/path_service.h" |
| +#include "base/utf_string_conversions.h" |
| #include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/chromeos/cros_settings.h" |
| +#include "chrome/browser/chromeos/cros_settings_provider.h" |
| +#include "chrome/browser/chromeos/system/timezone_settings.h" |
|
Joao da Silva
2012/07/27 13:40:57
Move these to the #if defined(OS_CHROMEOS) below
pneubeck (no reviews)
2012/07/31 22:21:05
Done.
|
| #include "chrome/browser/policy/async_policy_provider.h" |
| #include "chrome/browser/policy/cloud_policy_client.h" |
| #include "chrome/browser/policy/cloud_policy_provider.h" |
| @@ -567,9 +571,34 @@ void BrowserPolicyConnector::CompleteInitialization() { |
| g_browser_process->local_state(), |
| chromeos::system::StatisticsProvider::GetInstance(), |
| NULL)); |
| + |
| + SetTimezoneIfPolicyAvailable(); |
|
Joao da Silva
2012/07/27 13:40:57
Notice that CompleteInitialization() is only execu
pneubeck (no reviews)
2012/07/31 22:21:05
The only thing, I don't like about the "execute on
|
| #endif |
| } |
| +#if defined(OS_CHROMEOS) |
|
Joao da Silva
2012/07/27 13:40:57
Move the #ifdef into the method, and make the meth
pneubeck (no reviews)
2012/07/31 22:21:05
Done.
|
| +void BrowserPolicyConnector::SetTimezoneIfPolicyAvailable() { |
| + typedef chromeos::CrosSettingsProvider Provider; |
| + Provider::TrustedStatus result = |
| + chromeos::CrosSettings::Get()->PrepareTrustedValues( |
| + base::Bind(&BrowserPolicyConnector::SetTimezoneIfPolicyAvailable, |
| + weak_ptr_factory_.GetWeakPtr())); |
| + |
| + if (result == Provider::TEMPORARILY_UNTRUSTED || |
| + result == Provider::PERMANENTLY_UNTRUSTED) |
|
Joao da Silva
2012/07/27 13:40:57
Nit: indent of the 2nd line
Nit: braces when the c
pneubeck (no reviews)
2012/07/31 22:21:05
Done.
|
| + return; |
| + |
| + DCHECK_EQ(result, Provider::TRUSTED); |
| + |
| + std::string timezone; |
| + if (chromeos::CrosSettings::Get()->GetString( |
| + chromeos::kSystemTimezonePolicy, &timezone)) { |
| + chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
| + UTF8ToUTF16(timezone)); |
| + } |
| +} |
| +#endif |
| + |
| // static |
| ConfigurationPolicyProvider* BrowserPolicyConnector::CreatePlatformProvider() { |
| #if defined(OS_WIN) |