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

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

Issue 10825415: Added code to persist downloaded cloud policy to disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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_cloud_policy_store.h
diff --git a/chrome/browser/policy/user_cloud_policy_store.h b/chrome/browser/policy/user_cloud_policy_store.h
index 85141dd75118bc2e5953e5ece6112d89f2209d83..c504ee4d46fe2da41611af47e5df0d854e991a73 100644
--- a/chrome/browser/policy/user_cloud_policy_store.h
+++ b/chrome/browser/policy/user_cloud_policy_store.h
@@ -9,19 +9,23 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/policy/user_cloud_policy_store_base.h"
+#include "chrome/browser/policy/user_policy_disk_cache.h"
Mattias Nissler (ping if slow) 2012/08/20 15:29:30 This is a part of the chrome OS user policy legacy
Andrew T Wilson (Slow) 2012/08/20 18:04:37 OK, I'll roll my own version that doesn't use the
namespace policy {
// Implements a cloud policy store that is stored in a simple file in the user's
// profile directory. This is used on (non-chromeos) platforms that do not have
// a secure storage implementation.
-class UserCloudPolicyStore : public UserCloudPolicyStoreBase {
+class UserCloudPolicyStore : public UserCloudPolicyStoreBase,
+ public UserPolicyDiskCache::Delegate {
public:
// Creates a policy store associated with the user signed in to this
// |profile|.
- explicit UserCloudPolicyStore(Profile* profile);
+ explicit UserCloudPolicyStore(Profile* profile,
+ const FilePath& policy_file);
virtual ~UserCloudPolicyStore();
// CloudPolicyStore implementation.
@@ -29,6 +33,12 @@ class UserCloudPolicyStore : public UserCloudPolicyStoreBase {
virtual void Store(
const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
+ // UserPolicyDiskCache::Delegate implementation.
+ virtual void OnDiskCacheLoaded(
+ UserPolicyDiskCache::LoadResult result,
+ const enterprise_management::CachedCloudPolicyResponse& policy) OVERRIDE;
+
Mattias Nissler (ping if slow) 2012/08/20 15:29:30 remove extra blank line
Andrew T Wilson (Slow) 2012/08/21 23:18:19 Done.
+
private:
// Starts policy blob validation. |callback| is invoked once validation is
// complete.
@@ -36,11 +46,19 @@ class UserCloudPolicyStore : public UserCloudPolicyStoreBase {
scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
const UserCloudPolicyValidator::CompletionCallback& callback);
+ // Callback invoked to install a just-loaded policy after validation has
+ // finished.
+ void InstallLoadedPolicyAfterValidation(UserCloudPolicyValidator* validator);
+
// Callback invoked to store the policy after validation has finished.
void StorePolicyAfterValidation(UserCloudPolicyValidator* validator);
+ // WeakPtrFactory used to create callbacks for validating and storing policy.
base::WeakPtrFactory<UserCloudPolicyStore> weak_factory_;
+ // Helper object used to read/write policy to disk.
+ scoped_refptr<UserPolicyDiskCache> policy_cache_;
+
// Weak pointer to the profile associated with this store.
Profile* profile_;

Powered by Google App Engine
This is Rietveld 408576698