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

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

Issue 10693022: Add support for loading user cloud policy on desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed redundant #ifdef OS_CHROMEOS guard 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
new file mode 100644
index 0000000000000000000000000000000000000000..85141dd75118bc2e5953e5ece6112d89f2209d83
--- /dev/null
+++ b/chrome/browser/policy/user_cloud_policy_store.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_
+#define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/policy/user_cloud_policy_store_base.h"
+
+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 {
+ public:
+ // Creates a policy store associated with the user signed in to this
+ // |profile|.
+ explicit UserCloudPolicyStore(Profile* profile);
+ virtual ~UserCloudPolicyStore();
+
+ // CloudPolicyStore implementation.
+ virtual void Load() OVERRIDE;
+ virtual void Store(
+ const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
+
+ private:
+ // Starts policy blob validation. |callback| is invoked once validation is
+ // complete.
+ void Validate(
+ scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
+ const UserCloudPolicyValidator::CompletionCallback& callback);
+
+ // Callback invoked to store the policy after validation has finished.
+ void StorePolicyAfterValidation(UserCloudPolicyValidator* validator);
+
+ base::WeakPtrFactory<UserCloudPolicyStore> weak_factory_;
+
+ // Weak pointer to the profile associated with this store.
+ Profile* profile_;
+
+ DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_

Powered by Google App Engine
This is Rietveld 408576698