OLD | NEW |
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/cloud/user_cloud_policy_store_base.h" | 5 #include "chrome/browser/policy/cloud/user_cloud_policy_store_base.h" |
6 | 6 |
7 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 7 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
8 #include "policy/proto/cloud_policy.pb.h" | 8 #include "policy/proto/cloud_policy.pb.h" |
9 | 9 |
10 namespace policy { | 10 namespace policy { |
(...skipping 13 matching lines...) Expand all Loading... |
24 scoped_ptr<enterprise_management::PolicyFetchResponse> policy) { | 24 scoped_ptr<enterprise_management::PolicyFetchResponse> policy) { |
25 // Configure the validator. | 25 // Configure the validator. |
26 UserCloudPolicyValidator* validator = | 26 UserCloudPolicyValidator* validator = |
27 UserCloudPolicyValidator::Create(policy.Pass()); | 27 UserCloudPolicyValidator::Create(policy.Pass()); |
28 validator->ValidatePolicyType(GetChromeUserPolicyType()); | 28 validator->ValidatePolicyType(GetChromeUserPolicyType()); |
29 validator->ValidateAgainstCurrentPolicy( | 29 validator->ValidateAgainstCurrentPolicy( |
30 policy_.get(), | 30 policy_.get(), |
31 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED, | 31 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED, |
32 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED); | 32 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED); |
33 validator->ValidatePayload(); | 33 validator->ValidatePayload(); |
| 34 validator->ValidateHashValue(); |
34 return scoped_ptr<UserCloudPolicyValidator>(validator); | 35 return scoped_ptr<UserCloudPolicyValidator>(validator); |
35 } | 36 } |
36 | 37 |
37 void UserCloudPolicyStoreBase::InstallPolicy( | 38 void UserCloudPolicyStoreBase::InstallPolicy( |
38 scoped_ptr<enterprise_management::PolicyData> policy_data, | 39 scoped_ptr<enterprise_management::PolicyData> policy_data, |
39 scoped_ptr<enterprise_management::CloudPolicySettings> payload) { | 40 scoped_ptr<enterprise_management::CloudPolicySettings> payload, |
| 41 uint32 policy_hash_value) { |
40 // Decode the payload. | 42 // Decode the payload. |
41 policy_map_.Clear(); | 43 policy_map_.Clear(); |
42 DecodePolicy(*payload, &policy_map_); | 44 DecodePolicy(*payload, &policy_map_); |
43 policy_ = policy_data.Pass(); | 45 policy_ = policy_data.Pass(); |
| 46 SetPolicyHashValue(policy_hash_value); |
44 } | 47 } |
45 | 48 |
46 } // namespace policy | 49 } // namespace policy |
OLD | NEW |