diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-26 19:36:29 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-26 19:36:29 +0000 |
commit | 10c01b9237ffa755058f9344c6548a1d302bd5b8 (patch) | |
tree | a6fe9d7ea78a4a9cca0d5f470817924259936cf5 /chrome/browser/policy/device_policy_cache.cc | |
parent | 09f3707c586fb1a1fe4c46765509953d6d6f4871 (diff) | |
download | chromium_src-10c01b9237ffa755058f9344c6548a1d302bd5b8.zip chromium_src-10c01b9237ffa755058f9344c6548a1d302bd5b8.tar.gz chromium_src-10c01b9237ffa755058f9344c6548a1d302bd5b8.tar.bz2 |
Re-enable device activity time reporting.
Also, make sure that we only start device policy fetches once device
settings are available in order to ensure the first device policy fetch
uploads the configured reporting bits.
BUG=chromium-os:26251
TEST=Manual.
Review URL: https://chromiumcodereview.appspot.com/9857011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/policy/device_policy_cache.cc')
-rw-r--r-- | chrome/browser/policy/device_policy_cache.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/policy/device_policy_cache.cc b/chrome/browser/policy/device_policy_cache.cc index a140893..2b65504 100644 --- a/chrome/browser/policy/device_policy_cache.cc +++ b/chrome/browser/policy/device_policy_cache.cc @@ -205,10 +205,7 @@ void DevicePolicyCache::OnRetrievePolicyCompleted( if (!IsReady()) { std::string device_token; InstallInitialPolicy(code, policy, &device_token); - // We need to call SetDeviceToken unconditionally to indicate the cache has - // finished loading. - data_store_->SetDeviceToken(device_token, true); - SetReady(); + SetTokenAndFlagReady(device_token); } else { // In other words, IsReady() == true if (code != chromeos::SignedSettings::SUCCESS) { if (code == chromeos::SignedSettings::BAD_SIGNATURE) { @@ -316,6 +313,21 @@ void DevicePolicyCache::InstallInitialPolicy( set_last_policy_refresh_time(timestamp); } +void DevicePolicyCache::SetTokenAndFlagReady(const std::string& device_token) { + // Wait for device settings to become available. + if (!chromeos::CrosSettings::Get()->PrepareTrustedValues( + base::Bind(&DevicePolicyCache::SetTokenAndFlagReady, + weak_ptr_factory_.GetWeakPtr(), + device_token))) { + return; + } + + // We need to call SetDeviceToken unconditionally to indicate the cache has + // finished loading. + data_store_->SetDeviceToken(device_token, true); + SetReady(); +} + // static void DevicePolicyCache::DecodeLoginPolicies( const em::ChromeDeviceSettingsProto& policy, |