Index: chrome/browser/policy/cloud_policy_cache_base.h |
diff --git a/chrome/browser/policy/cloud_policy_cache_base.h b/chrome/browser/policy/cloud_policy_cache_base.h |
index 0fd89fcf78ca875a2ea2c323c45891cbfe1bcb18..109a1a9d4d2364334af66aa0d6d37d3df272f3a6 100644 |
--- a/chrome/browser/policy/cloud_policy_cache_base.h |
+++ b/chrome/browser/policy/cloud_policy_cache_base.h |
@@ -18,8 +18,8 @@ |
namespace policy { |
-class PolicyMap; |
class PolicyNotifier; |
+class CloudPolicyProvider; |
Mattias Nissler (ping if slow)
2011/05/31 14:14:19
Do you actually need that include?
sfeuz
2011/06/03 08:30:35
Nope. Done.
|
namespace em = enterprise_management; |
@@ -36,6 +36,13 @@ class CloudPolicyCacheBase : public base::NonThreadSafe { |
POLICY_LEVEL_RECOMMENDED, |
}; |
+ class Observer { |
+ public: |
+ virtual ~Observer() {} |
+ virtual void OnCacheGoingAway() = 0; |
+ virtual void OnCacheUpdate() = 0; |
+ }; |
+ |
CloudPolicyCacheBase(); |
virtual ~CloudPolicyCacheBase(); |
@@ -49,9 +56,6 @@ class CloudPolicyCacheBase : public base::NonThreadSafe { |
// Resets the policy information. |
virtual void SetPolicy(const em::PolicyFetchResponse& policy) = 0; |
- ConfigurationPolicyProvider* GetManagedPolicyProvider(); |
- ConfigurationPolicyProvider* GetRecommendedPolicyProvider(); |
- |
virtual void SetUnmanaged() = 0; |
bool is_unmanaged() const { |
return is_unmanaged_; |
@@ -67,6 +71,17 @@ class CloudPolicyCacheBase : public base::NonThreadSafe { |
// in. |
bool GetPublicKeyVersion(int* version); |
+ void AddObserver(Observer* observer); |
+ void RemoveObserver(Observer* observer); |
+ |
+ PolicyMap* mandatory_policy(); |
+ PolicyMap* recommended_policy(); |
Joao da Silva
2011/05/31 14:50:23
Shouldn't these be const?
sfeuz
2011/06/03 08:30:35
I agree. Done.
|
+ |
+ // See comment for |initialization_complete_|. |
+ bool initialization_complete() { |
+ return initialization_complete_; |
+ } |
+ |
protected: |
// Wraps public key version and validity. |
struct PublicKeyVersion { |
@@ -103,29 +118,19 @@ class CloudPolicyCacheBase : public base::NonThreadSafe { |
void InformNotifier(CloudPolicySubsystem::PolicySubsystemState state, |
CloudPolicySubsystem::ErrorDetails error_details); |
- // See comment for |initialization_complete_|. |
- bool initialization_complete() { |
- return initialization_complete_; |
- } |
- |
void set_last_policy_refresh_time(base::Time timestamp) { |
last_policy_refresh_time_ = timestamp; |
} |
private: |
- class CloudPolicyProvider; |
- |
friend class DevicePolicyCacheTest; |
friend class UserPolicyCacheTest; |
+ friend class MockCloudPolicyCacheBase; |
// Policy key-value information. |
PolicyMap mandatory_policy_; |
PolicyMap recommended_policy_; |
- // Policy providers. |
- scoped_ptr<ConfigurationPolicyProvider> managed_policy_provider_; |
- scoped_ptr<ConfigurationPolicyProvider> recommended_policy_provider_; |
- |
PolicyNotifier* notifier_; |
// The time at which the policy was last refreshed. Is updated both upon |
@@ -143,8 +148,8 @@ class CloudPolicyCacheBase : public base::NonThreadSafe { |
// Currently used public key version, if available. |
PublicKeyVersion public_key_version_; |
- // Provider observers that are registered with this cache's providers. |
- ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_; |
+ // Cache observers that are registered with this cache. |
+ ObserverList<Observer, true> observer_list_; |
DISALLOW_COPY_AND_ASSIGN(CloudPolicyCacheBase); |
}; |