| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_ |
| 6 #define CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_ | 6 #define CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class UserPolicyCache : public CloudPolicyCacheBase, | 30 class UserPolicyCache : public CloudPolicyCacheBase, |
| 31 public UserPolicyDiskCache::Delegate { | 31 public UserPolicyDiskCache::Delegate { |
| 32 public: | 32 public: |
| 33 explicit UserPolicyCache(const FilePath& backing_file_path); | 33 explicit UserPolicyCache(const FilePath& backing_file_path); |
| 34 virtual ~UserPolicyCache(); | 34 virtual ~UserPolicyCache(); |
| 35 | 35 |
| 36 // CloudPolicyCacheBase implementation: | 36 // CloudPolicyCacheBase implementation: |
| 37 virtual void Load() OVERRIDE; | 37 virtual void Load() OVERRIDE; |
| 38 virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE; | 38 virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE; |
| 39 virtual void SetUnmanaged() OVERRIDE; | 39 virtual void SetUnmanaged() OVERRIDE; |
| 40 virtual bool IsReady() OVERRIDE; |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 class DiskCache; | 43 class DiskCache; |
| 43 | 44 |
| 44 // UserPolicyDiskCache::Delegate implementation: | 45 // UserPolicyDiskCache::Delegate implementation: |
| 45 virtual void OnDiskCacheLoaded( | 46 virtual void OnDiskCacheLoaded( |
| 46 const em::CachedCloudPolicyResponse& cached_response) OVERRIDE; | 47 const em::CachedCloudPolicyResponse& cached_response) OVERRIDE; |
| 47 | 48 |
| 48 // CloudPolicyCacheBase implementation: | 49 // CloudPolicyCacheBase implementation: |
| 49 virtual bool DecodePolicyData(const em::PolicyData& policy_data, | 50 virtual bool DecodePolicyData(const em::PolicyData& policy_data, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 66 Value* DecodeValue(const em::GenericValue& value) const; | 67 Value* DecodeValue(const em::GenericValue& value) const; |
| 67 | 68 |
| 68 // </Old-style policy support> | 69 // </Old-style policy support> |
| 69 | 70 |
| 70 // Manages the cache file. | 71 // Manages the cache file. |
| 71 scoped_refptr<UserPolicyDiskCache> disk_cache_; | 72 scoped_refptr<UserPolicyDiskCache> disk_cache_; |
| 72 | 73 |
| 73 // Used for constructing the weak ptr passed to |disk_cache_|. | 74 // Used for constructing the weak ptr passed to |disk_cache_|. |
| 74 base::WeakPtrFactory<UserPolicyDiskCache::Delegate> weak_ptr_factory_; | 75 base::WeakPtrFactory<UserPolicyDiskCache::Delegate> weak_ptr_factory_; |
| 75 | 76 |
| 77 // Starts as false, set to true when the first request for policies from |
| 78 // disk is returned. |
| 79 bool first_load_complete_; |
| 80 |
| 76 DISALLOW_COPY_AND_ASSIGN(UserPolicyCache); | 81 DISALLOW_COPY_AND_ASSIGN(UserPolicyCache); |
| 77 }; | 82 }; |
| 78 | 83 |
| 79 } // namespace policy | 84 } // namespace policy |
| 80 | 85 |
| 81 #endif // CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_ | 86 #endif // CHROME_BROWSER_POLICY_USER_POLICY_CACHE_H_ |
| OLD | NEW |