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/settings/session_manager_operation.h" | 5 #include "chrome/browser/chromeos/settings/session_manager_operation.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 scoped_ptr<em::PolicyData> new_policy) | 244 scoped_ptr<em::PolicyData> new_policy) |
245 : SessionManagerOperation(callback), | 245 : SessionManagerOperation(callback), |
246 new_policy_(new_policy.Pass()), | 246 new_policy_(new_policy.Pass()), |
247 weak_factory_(this) { | 247 weak_factory_(this) { |
248 DCHECK(new_policy_); | 248 DCHECK(new_policy_); |
249 } | 249 } |
250 | 250 |
251 SignAndStoreSettingsOperation::~SignAndStoreSettingsOperation() {} | 251 SignAndStoreSettingsOperation::~SignAndStoreSettingsOperation() {} |
252 | 252 |
253 void SignAndStoreSettingsOperation::Run() { | 253 void SignAndStoreSettingsOperation::Run() { |
254 if (!delegate_) { | 254 if (!owner_settings_service_) { |
255 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); | 255 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); |
256 return; | 256 return; |
257 } | 257 } |
258 delegate_->IsOwnerAsync( | 258 owner_settings_service_->IsOwnerAsync( |
259 base::Bind(&SignAndStoreSettingsOperation::StartSigning, | 259 base::Bind(&SignAndStoreSettingsOperation::StartSigning, |
260 weak_factory_.GetWeakPtr())); | 260 weak_factory_.GetWeakPtr())); |
261 } | 261 } |
262 | 262 |
263 void SignAndStoreSettingsOperation::StartSigning(bool is_owner) { | 263 void SignAndStoreSettingsOperation::StartSigning(bool is_owner) { |
264 if (!delegate_ || !is_owner) { | 264 if (!owner_settings_service_ || !is_owner) { |
265 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); | 265 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); |
266 return; | 266 return; |
267 } | 267 } |
268 | 268 |
269 bool rv = delegate_->AssembleAndSignPolicyAsync( | 269 bool rv = owner_settings_service_->AssembleAndSignPolicyAsync( |
| 270 content::BrowserThread::GetBlockingPool(), |
270 new_policy_.Pass(), | 271 new_policy_.Pass(), |
271 base::Bind(&SignAndStoreSettingsOperation::StoreDeviceSettingsBlob, | 272 base::Bind(&SignAndStoreSettingsOperation::StoreDeviceSettingsBlob, |
272 weak_factory_.GetWeakPtr())); | 273 weak_factory_.GetWeakPtr())); |
273 if (!rv) { | 274 if (!rv) { |
274 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); | 275 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); |
275 return; | 276 return; |
276 } | 277 } |
277 } | 278 } |
278 | 279 |
279 void SignAndStoreSettingsOperation::StoreDeviceSettingsBlob( | 280 void SignAndStoreSettingsOperation::StoreDeviceSettingsBlob( |
(...skipping 10 matching lines...) Expand all Loading... |
290 } | 291 } |
291 | 292 |
292 void SignAndStoreSettingsOperation::HandleStoreResult(bool success) { | 293 void SignAndStoreSettingsOperation::HandleStoreResult(bool success) { |
293 if (!success) | 294 if (!success) |
294 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); | 295 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); |
295 else | 296 else |
296 StartLoading(); | 297 StartLoading(); |
297 } | 298 } |
298 | 299 |
299 } // namespace chromeos | 300 } // namespace chromeos |
OLD | NEW |