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

Side by Side Diff: chrome/browser/policy/user_cloud_policy_store_base.cc

Issue 10828032: Add DeviceSettingsService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/user_cloud_policy_store_base.h" 5 #include "chrome/browser/policy/user_cloud_policy_store_base.h"
6 6
7 #include "chrome/browser/policy/cloud_policy_constants.h" 7 #include "chrome/browser/policy/cloud_policy_constants.h"
8 #include "chrome/browser/policy/proto/cloud_policy.pb.h" 8 #include "chrome/browser/policy/proto/cloud_policy.pb.h"
9 9
10 namespace policy { 10 namespace policy {
11 11
12 // Decodes a CloudPolicySettings object into a policy map. The implementation is 12 // Decodes a CloudPolicySettings object into a policy map. The implementation is
13 // generated code in policy/cloud_policy_generated.cc. 13 // generated code in policy/cloud_policy_generated.cc.
14 void DecodePolicy(const enterprise_management::CloudPolicySettings& policy, 14 void DecodePolicy(const enterprise_management::CloudPolicySettings& policy,
15 PolicyMap* policies); 15 PolicyMap* policies);
16 16
17 UserCloudPolicyStoreBase::UserCloudPolicyStoreBase() { 17 UserCloudPolicyStoreBase::UserCloudPolicyStoreBase() {
18 } 18 }
19 19
20 UserCloudPolicyStoreBase::~UserCloudPolicyStoreBase() { 20 UserCloudPolicyStoreBase::~UserCloudPolicyStoreBase() {
21 } 21 }
22 22
23 scoped_ptr<UserCloudPolicyValidator> UserCloudPolicyStoreBase::CreateValidator( 23 scoped_ptr<UserCloudPolicyValidator> UserCloudPolicyStoreBase::CreateValidator(
24 scoped_ptr<enterprise_management::PolicyFetchResponse> policy, 24 scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
25 const UserCloudPolicyValidator::CompletionCallback& callback) { 25 const UserCloudPolicyValidator::CompletionCallback& callback) {
26 // Configure the validator. 26 // Configure the validator.
27 UserCloudPolicyValidator* validator = 27 UserCloudPolicyValidator* validator =
28 UserCloudPolicyValidator::Create(policy.Pass(), callback); 28 UserCloudPolicyValidator::Create(policy.Pass(), callback);
29 validator->ValidatePolicyType(dm_protocol::kChromeUserPolicyType); 29 validator->ValidatePolicyType(dm_protocol::kChromeUserPolicyType);
30 validator->ValidateAgainstCurrentPolicy(policy_.get()); 30 validator->ValidateAgainstCurrentPolicy(policy_.get(), false);
31 validator->ValidatePayload(); 31 validator->ValidatePayload();
32 return scoped_ptr<UserCloudPolicyValidator>(validator); 32 return scoped_ptr<UserCloudPolicyValidator>(validator);
33 } 33 }
34 34
35 void UserCloudPolicyStoreBase::InstallPolicy( 35 void UserCloudPolicyStoreBase::InstallPolicy(
36 scoped_ptr<enterprise_management::PolicyData> policy_data, 36 scoped_ptr<enterprise_management::PolicyData> policy_data,
37 scoped_ptr<enterprise_management::CloudPolicySettings> payload) { 37 scoped_ptr<enterprise_management::CloudPolicySettings> payload) {
38 // Decode the payload. 38 // Decode the payload.
39 policy_map_.Clear(); 39 policy_map_.Clear();
40 DecodePolicy(*payload, &policy_map_); 40 DecodePolicy(*payload, &policy_map_);
41 policy_ = policy_data.Pass(); 41 policy_ = policy_data.Pass();
42 } 42 }
43 43
44 } // namespace policy 44 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_builder.cc ('k') | chrome/browser/policy/user_cloud_policy_store_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698