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/chromeos/policy/device_local_account_policy_store.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account_policy_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/policy/cloud/device_management_service.h" | 9 #include "chrome/browser/policy/cloud/device_management_service.h" |
10 #include "chrome/browser/policy/policy_types.h" | 10 #include "chrome/browser/policy/policy_types.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 callback)); | 152 callback)); |
153 } | 153 } |
154 | 154 |
155 void DeviceLocalAccountPolicyStore::Validate( | 155 void DeviceLocalAccountPolicyStore::Validate( |
156 scoped_ptr<em::PolicyFetchResponse> policy_response, | 156 scoped_ptr<em::PolicyFetchResponse> policy_response, |
157 const UserCloudPolicyValidator::CompletionCallback& callback, | 157 const UserCloudPolicyValidator::CompletionCallback& callback, |
158 chromeos::DeviceSettingsService::OwnershipStatus ownership_status, | 158 chromeos::DeviceSettingsService::OwnershipStatus ownership_status, |
159 bool is_owner) { | 159 bool is_owner) { |
160 DCHECK_NE(chromeos::DeviceSettingsService::OWNERSHIP_UNKNOWN, | 160 DCHECK_NE(chromeos::DeviceSettingsService::OWNERSHIP_UNKNOWN, |
161 ownership_status); | 161 ownership_status); |
162 chromeos::OwnerKey* key = device_settings_service_->GetOwnerKey(); | 162 scoped_refptr<chromeos::OwnerKey> key = |
163 if (!key || !key->public_key()) { | 163 device_settings_service_->GetOwnerKey(); |
| 164 if (!key.get() || !key->public_key()) { |
164 status_ = CloudPolicyStore::STATUS_BAD_STATE; | 165 status_ = CloudPolicyStore::STATUS_BAD_STATE; |
165 NotifyStoreLoaded(); | 166 NotifyStoreLoaded(); |
166 return; | 167 return; |
167 } | 168 } |
168 | 169 |
169 scoped_ptr<UserCloudPolicyValidator> validator( | 170 scoped_ptr<UserCloudPolicyValidator> validator( |
170 UserCloudPolicyValidator::Create(policy_response.Pass())); | 171 UserCloudPolicyValidator::Create(policy_response.Pass())); |
171 validator->ValidateUsername(account_id_); | 172 validator->ValidateUsername(account_id_); |
172 validator->ValidatePolicyType(dm_protocol::kChromePublicAccountPolicyType); | 173 validator->ValidatePolicyType(dm_protocol::kChromePublicAccountPolicyType); |
173 validator->ValidateAgainstCurrentPolicy( | 174 validator->ValidateAgainstCurrentPolicy( |
174 policy(), | 175 policy(), |
175 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED, | 176 CloudPolicyValidatorBase::TIMESTAMP_REQUIRED, |
176 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED); | 177 CloudPolicyValidatorBase::DM_TOKEN_REQUIRED); |
177 validator->ValidatePayload(); | 178 validator->ValidatePayload(); |
178 validator->ValidateSignature(*key->public_key(), false); | 179 validator->ValidateSignature(*key->public_key(), false); |
179 validator.release()->StartValidation(callback); | 180 validator.release()->StartValidation(callback); |
180 } | 181 } |
181 | 182 |
182 } // namespace policy | 183 } // namespace policy |
OLD | NEW |