summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/device_settings_provider.cc7
-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
4 files changed, 27 insertions, 7 deletions
diff --git a/chrome/browser/chromeos/device_settings_provider.cc b/chrome/browser/chromeos/device_settings_provider.cc
index 59f6e1a..c24d778 100644
--- a/chrome/browser/chromeos/device_settings_provider.cc
+++ b/chrome/browser/chromeos/device_settings_provider.cc
@@ -480,8 +480,11 @@ void DeviceSettingsProvider::DecodeReportingPolicies(
kReportDeviceVersionInfo,
policy.device_reporting().report_version_info());
}
- // TODO(dubroy): Re-add device activity time policy here when the UI
- // to notify the user has been implemented (http://crosbug.com/26252).
+ if (policy.device_reporting().has_report_activity_times()) {
+ new_values_cache->SetBoolean(
+ kReportDeviceActivityTimes,
+ policy.device_reporting().report_activity_times());
+ }
if (policy.device_reporting().has_report_boot_mode()) {
new_values_cache->SetBoolean(
kReportDeviceBootMode,
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,