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/callback.h" | 8 #include "base/callback.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 10 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 bool valid_timestamp_required, | 134 bool valid_timestamp_required, |
135 scoped_ptr<em::PolicyFetchResponse> policy_response, | 135 scoped_ptr<em::PolicyFetchResponse> policy_response, |
136 const UserCloudPolicyValidator::CompletionCallback& callback, | 136 const UserCloudPolicyValidator::CompletionCallback& callback, |
137 chromeos::DeviceSettingsService::OwnershipStatus ownership_status) { | 137 chromeos::DeviceSettingsService::OwnershipStatus ownership_status) { |
138 DCHECK_NE(chromeos::DeviceSettingsService::OWNERSHIP_UNKNOWN, | 138 DCHECK_NE(chromeos::DeviceSettingsService::OWNERSHIP_UNKNOWN, |
139 ownership_status); | 139 ownership_status); |
140 const em::PolicyData* device_policy_data = | 140 const em::PolicyData* device_policy_data = |
141 device_settings_service_->policy_data(); | 141 device_settings_service_->policy_data(); |
142 scoped_refptr<ownership::PublicKey> key = | 142 scoped_refptr<ownership::PublicKey> key = |
143 device_settings_service_->GetPublicKey(); | 143 device_settings_service_->GetPublicKey(); |
144 if (!key || !key->is_loaded() || !device_policy_data) { | 144 if (!key.get() || !key->is_loaded() || !device_policy_data) { |
145 status_ = CloudPolicyStore::STATUS_BAD_STATE; | 145 status_ = CloudPolicyStore::STATUS_BAD_STATE; |
146 NotifyStoreLoaded(); | 146 NotifyStoreLoaded(); |
147 return; | 147 return; |
148 } | 148 } |
149 | 149 |
150 scoped_ptr<UserCloudPolicyValidator> validator( | 150 scoped_ptr<UserCloudPolicyValidator> validator( |
151 UserCloudPolicyValidator::Create(policy_response.Pass(), | 151 UserCloudPolicyValidator::Create(policy_response.Pass(), |
152 background_task_runner())); | 152 background_task_runner())); |
153 validator->ValidateUsername(account_id_, false); | 153 validator->ValidateUsername(account_id_, false); |
154 validator->ValidatePolicyType(dm_protocol::kChromePublicAccountPolicyType); | 154 validator->ValidatePolicyType(dm_protocol::kChromePublicAccountPolicyType); |
(...skipping 15 matching lines...) Expand all Loading... |
170 policy::BrowserPolicyConnectorChromeOS* connector = | 170 policy::BrowserPolicyConnectorChromeOS* connector = |
171 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 171 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
172 validator->ValidateSignature(key->as_string(), | 172 validator->ValidateSignature(key->as_string(), |
173 GetPolicyVerificationKey(), | 173 GetPolicyVerificationKey(), |
174 connector->GetEnterpriseDomain(), | 174 connector->GetEnterpriseDomain(), |
175 false); | 175 false); |
176 validator.release()->StartValidation(callback); | 176 validator.release()->StartValidation(callback); |
177 } | 177 } |
178 | 178 |
179 } // namespace policy | 179 } // namespace policy |
OLD | NEW |