Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3944)

Unified Diff: chrome/browser/policy/user_policy_cache.cc

Issue 9599009: Fix infinite refresh of device policy when the TPM gets out of sync with the stateful partition. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added unit test Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/policy/user_policy_cache.h ('k') | chrome/browser/policy/user_policy_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/user_policy_cache.cc
diff --git a/chrome/browser/policy/user_policy_cache.cc b/chrome/browser/policy/user_policy_cache.cc
index ec5afd94add6ab8c29be81d1ed09466eb0981bfc..16fae15b11053baf232cc3cf89482edc3f774367 100644
--- a/chrome/browser/policy/user_policy_cache.cc
+++ b/chrome/browser/policy/user_policy_cache.cc
@@ -42,12 +42,12 @@ void UserPolicyCache::Load() {
disk_cache_->Load();
}
-void UserPolicyCache::SetPolicy(const em::PolicyFetchResponse& policy) {
+bool UserPolicyCache::SetPolicy(const em::PolicyFetchResponse& policy) {
base::Time now = base::Time::NowFromSystemTime();
set_last_policy_refresh_time(now);
base::Time timestamp;
if (!SetPolicyInternal(policy, &timestamp, false))
- return;
+ return false;
UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyFetchOK,
kMetricPolicySize);
@@ -55,12 +55,13 @@ void UserPolicyCache::SetPolicy(const em::PolicyFetchResponse& policy) {
base::TimeDelta::FromMinutes(1)) {
LOG(WARNING) << "Server returned policy with timestamp from the future, "
"not persisting to disk.";
- return;
+ return false;
}
em::CachedCloudPolicyResponse cached_policy;
cached_policy.mutable_cloud_policy()->CopyFrom(policy);
disk_cache_->Store(cached_policy);
+ return true;
}
void UserPolicyCache::SetUnmanaged() {
« no previous file with comments | « chrome/browser/policy/user_policy_cache.h ('k') | chrome/browser/policy/user_policy_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698