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..7caea1e3612ac425cd514bac582a278d786eb284 100644 |
--- a/chrome/browser/policy/cloud/cloud_policy_store.h |
+++ b/chrome/browser/policy/cloud/cloud_policy_store.h |
@@ -73,6 +73,12 @@ class CloudPolicyStore { |
return validation_status_; |
} |
+ // Returns true if the latest policy loaded was different from the previous |
+ // policy. |
+ bool policy_changed() const { |
+ 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 |
@@ -93,11 +99,27 @@ 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_; |
+ } |
+ |
+ // Set the invalidation version. This method should be called immediately |
+ // before the Store method. |
+ void set_invalidation_version(int64 invalidation_version) { |
Joao da Silva
2013/07/23 20:44:47
Can this be part of the Store() method? Or maybe h
Steve Condie
2013/07/24 01:42:04
I agree it's better to make it one call. I conside
|
+ invalidation_version_ = invalidation_version; |
+ } |
protected: |
// Invokes the corresponding callback on all registered observers. |
void NotifyStoreLoaded(); |
void NotifyStoreError(); |
+ // Subclasses for which policy_changed() functionality is desired must call |
+ // this method when |policy_| is updated. |hash_value| must contain a hash |
+ // value calculated on the policy value, or be zero if there is no policy. |
+ void SetPolicyHashValue(uint32 hash_value); |
Joao da Silva
2013/07/23 20:44:47
A subclass may forget to call this, or do it in th
Steve Condie
2013/07/24 01:42:04
Done.
|
+ |
// Decoded version of the currently effective policy. |
PolicyMap policy_map_; |
@@ -115,6 +137,14 @@ class CloudPolicyStore { |
// triggered by calling Load(). |
bool is_initialized_; |
+ // The hash value of the current policy. This is used to determine when the |
+ // policy changes. |
+ uint32 hash_value_; |
+ |
+ bool policy_changed_; |
+ |
+ int64 invalidation_version_; |
+ |
ObserverList<Observer, true> observers_; |
DISALLOW_COPY_AND_ASSIGN(CloudPolicyStore); |