| 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..65352da054a160c6e1927b2374825f84797f00da 100644
|
| --- a/chrome/browser/policy/browser_policy_connector.cc
|
| +++ b/chrome/browser/policy/browser_policy_connector.cc
|
| @@ -44,8 +44,12 @@
|
| #endif
|
|
|
| #if defined(OS_CHROMEOS)
|
| +#include "base/utf_string_conversions.h"
|
| #include "chrome/browser/chromeos/cros/cros_library.h"
|
| +#include "chrome/browser/chromeos/settings/cros_settings.h"
|
| +#include "chrome/browser/chromeos/settings/cros_settings_provider.h"
|
| #include "chrome/browser/chromeos/system/statistics_provider.h"
|
| +#include "chrome/browser/chromeos/system/timezone_settings.h"
|
| #include "chrome/browser/policy/app_pack_updater.h"
|
| #include "chrome/browser/policy/cros_user_policy_cache.h"
|
| #include "chrome/browser/policy/device_policy_cache.h"
|
| @@ -148,12 +152,10 @@ void BrowserPolicyConnector::Init() {
|
|
|
| InitializeDevicePolicy();
|
|
|
| - // Create the AppPackUpdater to start updating the cache. It requires the
|
| - // system request context, which isn't available yet; therefore it is
|
| - // created only once the loops are running.
|
| + // Complete the initialization once the message loops are spinning.
|
| MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(base::IgnoreResult(&BrowserPolicyConnector::GetAppPackUpdater),
|
| + base::Bind(&BrowserPolicyConnector::CompleteInitialization,
|
| weak_ptr_factory_.GetWeakPtr()));
|
| #endif
|
| }
|
| @@ -522,12 +524,6 @@ void BrowserPolicyConnector::InitializeDevicePolicy() {
|
| device_cloud_policy_subsystem_.reset(new CloudPolicySubsystem(
|
| device_data_store_.get(),
|
| device_policy_cache));
|
| -
|
| - // Initialize the subsystem once the message loops are spinning.
|
| - MessageLoop::current()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&BrowserPolicyConnector::CompleteInitialization,
|
| - weak_ptr_factory_.GetWeakPtr()));
|
| }
|
| }
|
| #endif
|
| @@ -535,6 +531,11 @@ void BrowserPolicyConnector::InitializeDevicePolicy() {
|
|
|
| void BrowserPolicyConnector::CompleteInitialization() {
|
| #if defined(OS_CHROMEOS)
|
| + // Create the AppPackUpdater to start updating the cache. It requires the
|
| + // system request context, which isn't available in Init(); therefore it is
|
| + // created only once the loops are running.
|
| + GetAppPackUpdater();
|
| +
|
| if (device_cloud_policy_subsystem_.get()) {
|
| // Read serial number and machine model. This must be done before we call
|
| // CompleteInitialization() below such that the serial number is available
|
| @@ -567,6 +568,28 @@ void BrowserPolicyConnector::CompleteInitialization() {
|
| g_browser_process->local_state(),
|
| chromeos::system::StatisticsProvider::GetInstance(),
|
| NULL));
|
| +
|
| + SetTimezoneIfPolicyAvailable();
|
| +#endif
|
| +}
|
| +
|
| +void BrowserPolicyConnector::SetTimezoneIfPolicyAvailable() {
|
| +#if defined(OS_CHROMEOS)
|
| + typedef chromeos::CrosSettingsProvider Provider;
|
| + Provider::TrustedStatus result =
|
| + chromeos::CrosSettings::Get()->PrepareTrustedValues(
|
| + base::Bind(&BrowserPolicyConnector::SetTimezoneIfPolicyAvailable,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| +
|
| + if (result != Provider::TRUSTED)
|
| + return;
|
| +
|
| + std::string timezone;
|
| + if (chromeos::CrosSettings::Get()->GetString(
|
| + chromeos::kSystemTimezonePolicy, &timezone)) {
|
| + chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID(
|
| + UTF8ToUTF16(timezone));
|
| + }
|
| #endif
|
| }
|
|
|
|
|