Chromium Code Reviews| Index: chrome/browser/policy/user_policy_token_cache.h |
| diff --git a/chrome/browser/policy/user_policy_token_cache.h b/chrome/browser/policy/user_policy_token_cache.h |
| index e9ab99d84a1e799d28df83a1012536eb6b52d746..497a0c28c4051071f84796de240c448792eddb99 100644 |
| --- a/chrome/browser/policy/user_policy_token_cache.h |
| +++ b/chrome/browser/policy/user_policy_token_cache.h |
| @@ -12,23 +12,17 @@ |
| #include "base/file_path.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/weak_ptr.h" |
|
Joao da Silva
2011/07/06 16:45:14
Nit: weak_ptr.h not used
gfeher
2011/07/07 13:51:00
Now that you mention, I actually reintroduce using
|
| +#include "chrome/browser/policy/cloud_policy_data.h" |
| #include "chrome/browser/policy/proto/device_management_local.pb.h" |
|
Joao da Silva
2011/07/06 16:45:14
Nit: move device_management_local.pb.h to .cc
gfeher
2011/07/07 13:51:00
Done.
|
| namespace policy { |
| // Responsible for managing the on-disk token cache. |
| class UserPolicyTokenCache |
| - : public base::RefCountedThreadSafe<UserPolicyTokenCache> { |
| + : public base::RefCountedThreadSafe<UserPolicyTokenCache>, |
| + public CloudPolicyData::Observer { |
| public: |
| - // Callback interface for reporting a successfull load. |
| - class Delegate { |
| - public: |
| - virtual ~Delegate(); |
| - virtual void OnTokenCacheLoaded(const std::string& token, |
| - const std::string& device_id) = 0; |
| - }; |
| - |
| - UserPolicyTokenCache(const base::WeakPtr<Delegate>& delegate, |
| + UserPolicyTokenCache(CloudPolicyData* data, |
| const FilePath& cache_file); |
| // Starts loading the disk cache. After the load is finished, the result is |
| @@ -38,9 +32,14 @@ class UserPolicyTokenCache |
| // Stores credentials asynchronously to disk. |
| void Store(const std::string& token, const std::string& device_id); |
| + // CloudPolicyData::Observer implementation: |
| + virtual void OnDeviceTokenChanged() OVERRIDE; |
| + virtual void OnCredentialsChanged() OVERRIDE; |
| + virtual void OnPolicyDataGoingAway() OVERRIDE; |
| + |
| private: |
| friend class base::RefCountedThreadSafe<UserPolicyTokenCache>; |
| - ~UserPolicyTokenCache(); |
| + virtual ~UserPolicyTokenCache(); |
| void LoadOnFileThread(); |
| void NotifyOnUIThread(const std::string& token, |
| @@ -48,7 +47,7 @@ class UserPolicyTokenCache |
| void StoreOnFileThread(const std::string& token, |
| const std::string& device_id); |
| - const base::WeakPtr<Delegate> delegate_; |
| + CloudPolicyData* data_; |
| const FilePath cache_file_; |
| DISALLOW_COPY_AND_ASSIGN(UserPolicyTokenCache); |