Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7601)

Unified Diff: chrome/browser/policy/user_policy_token_cache.h

Issue 7298012: Consolidate data storage and notifications in the cloud policy subsystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e7eeed50290ef12edb440a78f94ef6a5bd19d4b3 100644
--- a/chrome/browser/policy/user_policy_token_cache.h
+++ b/chrome/browser/policy/user_policy_token_cache.h
@@ -12,23 +12,16 @@
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/policy/proto/device_management_local.pb.h"
+#include "chrome/browser/policy/cloud_policy_data_store.h"
namespace policy {
// Responsible for managing the on-disk token cache.
class UserPolicyTokenCache
- : public base::RefCountedThreadSafe<UserPolicyTokenCache> {
+ : public base::RefCountedThreadSafe<UserPolicyTokenCache>,
+ public CloudPolicyDataStore::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(const base::WeakPtr<CloudPolicyDataStore>& data_store,
const FilePath& cache_file);
// Starts loading the disk cache. After the load is finished, the result is
@@ -38,9 +31,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 OnDataStoreGoingAway() OVERRIDE;
+
private:
friend class base::RefCountedThreadSafe<UserPolicyTokenCache>;
- ~UserPolicyTokenCache();
+ virtual ~UserPolicyTokenCache();
void LoadOnFileThread();
void NotifyOnUIThread(const std::string& token,
@@ -48,7 +46,7 @@ class UserPolicyTokenCache
void StoreOnFileThread(const std::string& token,
const std::string& device_id);
- const base::WeakPtr<Delegate> delegate_;
+ const base::WeakPtr<CloudPolicyDataStore> data_store_;
const FilePath cache_file_;
DISALLOW_COPY_AND_ASSIGN(UserPolicyTokenCache);
« no previous file with comments | « chrome/browser/policy/user_policy_identity_strategy.cc ('k') | chrome/browser/policy/user_policy_token_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698