Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/policy/user_cloud_policy_store_base.h" | |
| 6 | |
| 7 #include "chrome/browser/policy/cloud_policy_constants.h" | |
| 8 #include "chrome/browser/policy/proto/cloud_policy.pb.h" | |
| 9 #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.
| |
| 10 | |
| 11 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
| |
| 12 | |
| 13 namespace policy { | |
| 14 | |
| 15 // Decodes a CloudPolicySettings object into a policy map. The implementation is | |
| 16 // generated code in policy/cloud_policy_generated.cc. | |
| 17 void DecodePolicy(const enterprise_management::CloudPolicySettings& policy, | |
| 18 PolicyMap* policies); | |
| 19 | |
| 20 UserCloudPolicyStoreBase::UserCloudPolicyStoreBase() { | |
| 21 } | |
| 22 | |
| 23 UserCloudPolicyStoreBase::~UserCloudPolicyStoreBase() { | |
| 24 } | |
| 25 | |
| 26 scoped_ptr<UserCloudPolicyValidator> UserCloudPolicyStoreBase::CreateValidator( | |
| 27 scoped_ptr<enterprise_management::PolicyFetchResponse> policy, | |
| 28 const UserCloudPolicyValidator::CompletionCallback& callback) { | |
| 29 // Configure the validator. | |
| 30 UserCloudPolicyValidator* validator = | |
| 31 UserCloudPolicyValidator::Create(policy.Pass(), callback); | |
| 32 validator->ValidatePolicyType(dm_protocol::kChromeUserPolicyType); | |
| 33 validator->ValidateAgainstCurrentPolicy(policy_.get()); | |
| 34 validator->ValidatePayload(); | |
| 35 return scoped_ptr<UserCloudPolicyValidator>(validator); | |
| 36 } | |
| 37 | |
| 38 void UserCloudPolicyStoreBase::InstallPolicy( | |
| 39 scoped_ptr<enterprise_management::PolicyData> policy_data, | |
| 40 scoped_ptr<enterprise_management::CloudPolicySettings> payload) { | |
| 41 // Decode the payload. | |
| 42 policy_map_.Clear(); | |
| 43 DecodePolicy(*payload, &policy_map_); | |
| 44 policy_ = policy_data.Pass(); | |
| 45 } | |
| 46 | |
| 47 } // namespace policy | |
| OLD | NEW |