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

Unified Diff: chrome/browser/policy/cloud/cloud_policy_store.h

Issue 19733003: Implement cloud policy invalidations using the invalidation service framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
Index: chrome/browser/policy/cloud/cloud_policy_store.h
diff --git a/chrome/browser/policy/cloud/cloud_policy_store.h b/chrome/browser/policy/cloud/cloud_policy_store.h
index fee92b7218d9a30f3d35901cd2dc2ff838138904..75cab26069eefc14c484f7d715857c3b02ff50c6 100644
--- a/chrome/browser/policy/cloud/cloud_policy_store.h
+++ b/chrome/browser/policy/cloud/cloud_policy_store.h
@@ -73,11 +73,23 @@ class CloudPolicyStore {
return validation_status_;
}
+ // Returns true if the latest policy loaded was different from the previous
+ // policy.
+ bool policy_changed() const {
Mattias Nissler (ping if slow) 2013/08/28 14:20:40 AFAICS, the only user of this is CloudPolicyInvali
Steve Condie 2013/09/07 01:11:20 Opened bug 286613 to track refactoring the policy
+ return policy_changed_;
+ }
+
// Store a new policy blob. Pending load/store operations will be canceled.
// The store operation may proceed asynchronously and observers are notified
// once the operation finishes. If successful, OnStoreLoaded() will be invoked
// on the observers and the updated policy can be read through policy().
// Errors generate OnStoreError() notifications.
+ // |invalidation_version| is the invalidation version of the policy to be
+ // stored.
+ void Store(
+ const enterprise_management::PolicyFetchResponse& policy,
+ int64 invalidation_version);
+
virtual void Store(
const enterprise_management::PolicyFetchResponse& policy) = 0;
@@ -93,6 +105,12 @@ class CloudPolicyStore {
// Removes the specified observer.
void RemoveObserver(Observer* observer);
+ // The invalidation version of the last policy stored. This value can be read
+ // by observers to determine which version of the policy is now available.
+ int64 invalidation_version() {
+ return invalidation_version_;
+ }
+
protected:
// Invokes the corresponding callback on all registered observers.
void NotifyStoreLoaded();
@@ -110,11 +128,21 @@ class CloudPolicyStore {
// Latest validation status.
CloudPolicyValidatorBase::Status validation_status_;
+ // The invalidation version of the last policy stored.
+ int64 invalidation_version_;
+
private:
// Whether the store has completed asynchronous initialization, which is
// triggered by calling Load().
bool is_initialized_;
+ // Whether latest policy loaded was different from the previous policy.
+ bool policy_changed_;
+
+ // The hash value of the current policy. This is used to determine when the
+ // policy changes.
+ uint32 hash_value_;
+
ObserverList<Observer, true> observers_;
DISALLOW_COPY_AND_ASSIGN(CloudPolicyStore);

Powered by Google App Engine
This is Rietveld 408576698