Index: chrome/browser/policy/user_policy_cache.h |
diff --git a/chrome/browser/policy/user_policy_cache.h b/chrome/browser/policy/user_policy_cache.h |
index a065e193a5a4b8d710f636f0f249b1998e4db503..a32a36a5da7c4e1e4baed2fb5e31ced53191a9f2 100644 |
--- a/chrome/browser/policy/user_policy_cache.h |
+++ b/chrome/browser/policy/user_policy_cache.h |
@@ -36,13 +36,18 @@ class PolicyMap; |
class UserPolicyCache : public CloudPolicyCacheBase, |
public UserPolicyDiskCache::Delegate { |
public: |
- explicit UserPolicyCache(const FilePath& backing_file_path); |
+ // |backing_file_path| is the path to the cache file. |
+ // |wait_for_policy_fetch| is true if the cache should be ready only after |
+ // an attempt was made to fetch user policy. |
+ UserPolicyCache(const FilePath& backing_file_path, |
+ bool wait_for_policy_fetch); |
virtual ~UserPolicyCache(); |
// CloudPolicyCacheBase implementation: |
virtual void Load() OVERRIDE; |
virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE; |
virtual void SetUnmanaged() OVERRIDE; |
+ virtual void SetFetchingDone() OVERRIDE; |
private: |
class DiskCache; |
@@ -57,6 +62,9 @@ class UserPolicyCache : public CloudPolicyCacheBase, |
PolicyMap* mandatory, |
PolicyMap* recommended) OVERRIDE; |
+ // Checks if this cache is ready, and invokes SetReady() if so. |
+ void CheckIfReady(); |
+ |
// <Old-style policy support> |
// The following member functions are needed to support old-style policy and |
// can be removed once all server-side components (CPanel, D3) have been |
@@ -80,6 +88,13 @@ class UserPolicyCache : public CloudPolicyCacheBase, |
// Used for constructing the weak ptr passed to |disk_cache_|. |
base::WeakPtrFactory<UserPolicyDiskCache::Delegate> weak_ptr_factory_; |
+ // True if the disk cache has been loaded. |
+ bool disk_cache_ready_; |
+ |
+ // True if at least one attempt was made to refresh the cache with a freshly |
+ // fetched policy, or if there is no need to wait for that. |
+ bool fetch_ready_; |
+ |
DISALLOW_COPY_AND_ASSIGN(UserPolicyCache); |
}; |