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

Unified Diff: chrome/browser/policy/user_cloud_policy_store_base.cc

Issue 10693022: Add support for loading user cloud policy on desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaked some comments after self-review. Created 8 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_cloud_policy_store_base.cc
diff --git a/chrome/browser/policy/user_cloud_policy_store_base.cc b/chrome/browser/policy/user_cloud_policy_store_base.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d36d26fe6259d3f0a6a6f7ba4df61f0433ab1936
--- /dev/null
+++ b/chrome/browser/policy/user_cloud_policy_store_base.cc
@@ -0,0 +1,47 @@
+// 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.
+
+#include "chrome/browser/policy/user_cloud_policy_store_base.h"
+
+#include "chrome/browser/policy/cloud_policy_constants.h"
+#include "chrome/browser/policy/proto/cloud_policy.pb.h"
+#include "chrome/browser/signin/signin_manager.h"
Mattias Nissler (ping if slow) 2012/08/03 12:19:08 used?
Andrew T Wilson (Slow) 2012/08/04 00:54:41 Done.
+
+using enterprise_management::PolicyData;
Mattias Nissler (ping if slow) 2012/08/03 12:19:08 Used? We have the convention to declare a namespac
Andrew T Wilson (Slow) 2012/08/04 00:54:41 We don't need the using directive, so I've removed
+
+namespace policy {
+
+// Decodes a CloudPolicySettings object into a policy map. The implementation is
+// generated code in policy/cloud_policy_generated.cc.
+void DecodePolicy(const enterprise_management::CloudPolicySettings& policy,
+ PolicyMap* policies);
+
+UserCloudPolicyStoreBase::UserCloudPolicyStoreBase() {
+}
+
+UserCloudPolicyStoreBase::~UserCloudPolicyStoreBase() {
+}
+
+scoped_ptr<UserCloudPolicyValidator> UserCloudPolicyStoreBase::CreateValidator(
+ scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
+ const UserCloudPolicyValidator::CompletionCallback& callback) {
+ // Configure the validator.
+ UserCloudPolicyValidator* validator =
+ UserCloudPolicyValidator::Create(policy.Pass(), callback);
+ validator->ValidatePolicyType(dm_protocol::kChromeUserPolicyType);
+ validator->ValidateAgainstCurrentPolicy(policy_.get());
+ validator->ValidatePayload();
+ return scoped_ptr<UserCloudPolicyValidator>(validator);
+}
+
+void UserCloudPolicyStoreBase::InstallPolicy(
+ scoped_ptr<enterprise_management::PolicyData> policy_data,
+ scoped_ptr<enterprise_management::CloudPolicySettings> payload) {
+ // Decode the payload.
+ policy_map_.Clear();
+ DecodePolicy(*payload, &policy_map_);
+ policy_ = policy_data.Pass();
+}
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698