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/login/signed_settings.h" | 5 #include "chrome/browser/chromeos/login/signed_settings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 payload.end())); | 186 payload.end())); |
187 RequestStorePolicy(); | 187 RequestStorePolicy(); |
188 return; | 188 return; |
189 } | 189 } |
190 Fail(SignedSettings::MapKeyOpCode(return_code)); | 190 Fail(SignedSettings::MapKeyOpCode(return_code)); |
191 } | 191 } |
192 | 192 |
193 void StorePolicyOp::RequestStorePolicy() { | 193 void StorePolicyOp::RequestStorePolicy() { |
194 std::string serialized; | 194 std::string serialized; |
195 if (policy_->SerializeToString(&serialized)) { | 195 if (policy_->SerializeToString(&serialized)) { |
196 DBusThreadManager::Get()->GetSessionManagerClient()->StorePolicy( | 196 DBusThreadManager::Get()->GetSessionManagerClient()->StoreDevicePolicy( |
197 serialized, | 197 serialized, |
198 base::Bind(&StorePolicyOp::OnBoolComplete, this)); | 198 base::Bind(&StorePolicyOp::OnBoolComplete, this)); |
199 } else { | 199 } else { |
200 Fail(OPERATION_FAILED); | 200 Fail(OPERATION_FAILED); |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 void StorePolicyOp::PerformCallback(SignedSettings::ReturnCode code, | 204 void StorePolicyOp::PerformCallback(SignedSettings::ReturnCode code, |
205 bool value) { | 205 bool value) { |
206 d_->OnSettingsOpCompleted(code, value); | 206 d_->OnSettingsOpCompleted(code, value); |
207 } | 207 } |
208 | 208 |
209 RetrievePolicyOp::RetrievePolicyOp( | 209 RetrievePolicyOp::RetrievePolicyOp( |
210 SignedSettings::Delegate<const em::PolicyFetchResponse&>* d) | 210 SignedSettings::Delegate<const em::PolicyFetchResponse&>* d) |
211 : d_(d) { | 211 : d_(d) { |
212 } | 212 } |
213 | 213 |
214 RetrievePolicyOp::~RetrievePolicyOp() {} | 214 RetrievePolicyOp::~RetrievePolicyOp() {} |
215 | 215 |
216 void RetrievePolicyOp::Execute() { | 216 void RetrievePolicyOp::Execute() { |
217 DBusThreadManager::Get()->GetSessionManagerClient()->RetrievePolicy( | 217 DBusThreadManager::Get()->GetSessionManagerClient()->RetrieveDevicePolicy( |
218 base::Bind(&RetrievePolicyOp::OnStringComplete, this)); | 218 base::Bind(&RetrievePolicyOp::OnStringComplete, this)); |
219 } | 219 } |
220 | 220 |
221 void RetrievePolicyOp::Fail(SignedSettings::ReturnCode code) { | 221 void RetrievePolicyOp::Fail(SignedSettings::ReturnCode code) { |
222 VLOG(2) << "RetrievePolicyOp::Execute() failed with " << code; | 222 VLOG(2) << "RetrievePolicyOp::Execute() failed with " << code; |
223 BrowserThread::PostTask( | 223 BrowserThread::PostTask( |
224 BrowserThread::UI, FROM_HERE, | 224 BrowserThread::UI, FROM_HERE, |
225 base::Bind(&RetrievePolicyOp::PerformCallback, this, code, | 225 base::Bind(&RetrievePolicyOp::PerformCallback, this, code, |
226 em::PolicyFetchResponse())); | 226 em::PolicyFetchResponse())); |
227 } | 227 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length()); | 277 sig.assign(sig_ptr, sig_ptr + policy_.policy_data_signature().length()); |
278 service_->StartVerifyAttempt(policy_.policy_data(), sig, this); | 278 service_->StartVerifyAttempt(policy_.policy_data(), sig, this); |
279 } | 279 } |
280 | 280 |
281 void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code, | 281 void RetrievePolicyOp::PerformCallback(SignedSettings::ReturnCode code, |
282 const em::PolicyFetchResponse& value) { | 282 const em::PolicyFetchResponse& value) { |
283 d_->OnSettingsOpCompleted(code, value); | 283 d_->OnSettingsOpCompleted(code, value); |
284 } | 284 } |
285 | 285 |
286 } // namespace chromeos | 286 } // namespace chromeos |
OLD | NEW |