| 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 LoadSettingsOperation::LoadSettingsOperation(const Callback& callback) | 180 LoadSettingsOperation::LoadSettingsOperation(const Callback& callback) |
| 181 : SessionManagerOperation(callback) {} | 181 : SessionManagerOperation(callback) {} |
| 182 | 182 |
| 183 LoadSettingsOperation::~LoadSettingsOperation() {} | 183 LoadSettingsOperation::~LoadSettingsOperation() {} |
| 184 | 184 |
| 185 void LoadSettingsOperation::Run() { | 185 void LoadSettingsOperation::Run() { |
| 186 StartLoading(); | 186 StartLoading(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 StoreSettingsOperation::StoreSettingsOperation(const Callback& callback, | 189 StoreSettingsOperation::StoreSettingsOperation( |
| 190 const std::string& policy_blob) | 190 const Callback& callback, |
| 191 scoped_ptr<em::PolicyFetchResponse> policy) |
| 191 : SessionManagerOperation(callback), | 192 : SessionManagerOperation(callback), |
| 192 policy_blob_(policy_blob), | 193 policy_(policy.Pass()), |
| 193 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} | 194 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} |
| 194 | 195 |
| 195 StoreSettingsOperation::~StoreSettingsOperation() {} | 196 StoreSettingsOperation::~StoreSettingsOperation() {} |
| 196 | 197 |
| 197 void StoreSettingsOperation::Run() { | 198 void StoreSettingsOperation::Run() { |
| 198 session_manager_client()->StoreDevicePolicy( | 199 session_manager_client()->StoreDevicePolicy( |
| 199 policy_blob_, | 200 policy_->SerializeAsString(), |
| 200 base::Bind(&StoreSettingsOperation::HandleStoreResult, | 201 base::Bind(&StoreSettingsOperation::HandleStoreResult, |
| 201 weak_factory_.GetWeakPtr())); | 202 weak_factory_.GetWeakPtr())); |
| 202 } | 203 } |
| 203 | 204 |
| 204 void StoreSettingsOperation::HandleStoreResult(bool success) { | 205 void StoreSettingsOperation::HandleStoreResult(bool success) { |
| 205 if (!success) | 206 if (!success) |
| 206 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); | 207 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); |
| 207 else | 208 else |
| 208 StartLoading(); | 209 StartLoading(); |
| 209 } | 210 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 293 } |
| 293 | 294 |
| 294 void SignAndStoreSettingsOperation::HandleStoreResult(bool success) { | 295 void SignAndStoreSettingsOperation::HandleStoreResult(bool success) { |
| 295 if (!success) | 296 if (!success) |
| 296 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); | 297 ReportResult(DeviceSettingsService::STORE_OPERATION_FAILED); |
| 297 else | 298 else |
| 298 StartLoading(); | 299 StartLoading(); |
| 299 } | 300 } |
| 300 | 301 |
| 301 } // namespace chromeos | 302 } // namespace chromeos |
| OLD | NEW |