summaryrefslogtreecommitdiffstats
path: root/chrome/browser/policy
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-26 19:36:29 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-26 19:36:29 +0000
commit10c01b9237ffa755058f9344c6548a1d302bd5b8 (patch)
treea6fe9d7ea78a4a9cca0d5f470817924259936cf5 /chrome/browser/policy
parent09f3707c586fb1a1fe4c46765509953d6d6f4871 (diff)
downloadchromium_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')
-rw-r--r--chrome/browser/policy/cloud_policy_controller.cc1
-rw-r--r--chrome/browser/policy/device_policy_cache.cc20
-rw-r--r--chrome/browser/policy/device_policy_cache.h6
3 files changed, 22 insertions, 5 deletions
diff --git a/chrome/browser/policy/cloud_policy_controller.cc b/chrome/browser/policy/cloud_policy_controller.cc
index d3d8b96..4622c90 100644
--- a/chrome/browser/policy/cloud_policy_controller.cc
+++ b/chrome/browser/policy/cloud_policy_controller.cc
@@ -337,7 +337,6 @@ void CloudPolicyController::SendPolicyRequest() {
em::DeviceManagementRequest* request = request_job_->GetRequest();
em::PolicyFetchRequest* fetch_request =
request->mutable_policy_request()->add_request();
- em::DeviceStatusReportRequest device_status;
fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA);
fetch_request->set_policy_type(data_store_->policy_type());
if (cache_->machine_id_missing() && !data_store_->machine_id().empty())
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,
diff --git a/chrome/browser/policy/device_policy_cache.h b/chrome/browser/policy/device_policy_cache.h
index 21ee8e4..3bf5348 100644
--- a/chrome/browser/policy/device_policy_cache.h
+++ b/chrome/browser/policy/device_policy_cache.h
@@ -68,6 +68,12 @@ class DevicePolicyCache : public CloudPolicyCacheBase {
const enterprise_management::PolicyFetchResponse& policy,
std::string* device_token);
+ // Ensures that CrosSettings has established trust on the reporting prefs and
+ // publishes the |device_token| loaded from the cache. It's important that we
+ // have fully-initialized device settings s.t. device status uploads get the
+ // correct reporting policy flags.
+ void SetTokenAndFlagReady(const std::string& device_token);
+
// Decode the various groups of policies.
static void DecodeLoginPolicies(
const enterprise_management::ChromeDeviceSettingsProto& policy,