| 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 (!owner_settings_service_) { | 254 if (!delegate_) { |
| 255 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); | 255 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); |
| 256 return; | 256 return; |
| 257 } | 257 } |
| 258 owner_settings_service_->IsOwnerAsync( | 258 delegate_->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 (!owner_settings_service_ || !is_owner) { | 264 if (!delegate_ || !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 = owner_settings_service_->AssembleAndSignPolicyAsync( | 269 bool rv = delegate_->AssembleAndSignPolicyAsync( |
| 270 content::BrowserThread::GetBlockingPool(), | |
| 271 new_policy_.Pass(), | 270 new_policy_.Pass(), |
| 272 base::Bind(&SignAndStoreSettingsOperation::StoreDeviceSettingsBlob, | 271 base::Bind(&SignAndStoreSettingsOperation::StoreDeviceSettingsBlob, |
| 273 weak_factory_.GetWeakPtr())); | 272 weak_factory_.GetWeakPtr())); |
| 274 if (!rv) { | 273 if (!rv) { |
| 275 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); | 274 ReportResult(DeviceSettingsService::STORE_KEY_UNAVAILABLE); |
| 276 return; | 275 return; |
| 277 } | 276 } |
| 278 } | 277 } |
| 279 | 278 |
| 280 void SignAndStoreSettingsOperation::StoreDeviceSettingsBlob( | 279 void SignAndStoreSettingsOperation::StoreDeviceSettingsBlob( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 291 } | 290 } |
| 292 | 291 |
| 293 void SignAndStoreSettingsOperation::HandleStoreResult(bool success) { | 292 void SignAndStoreSettingsOperation::HandleStoreResult(bool success) { |
| 294 if (!success) | 293 if (!success) |
| 295 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); | 294 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); |
| 296 else | 295 else |
| 297 StartLoading(); | 296 StartLoading(); |
| 298 } | 297 } |
| 299 | 298 |
| 300 } // namespace chromeos | 299 } // namespace chromeos |
| OLD | NEW |