| 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/user_cloud_policy_store_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.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/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 std::string policy_blob; | 312 std::string policy_blob; |
| 313 if (!validator->policy()->SerializeToString(&policy_blob)) { | 313 if (!validator->policy()->SerializeToString(&policy_blob)) { |
| 314 status_ = STATUS_SERIALIZE_ERROR; | 314 status_ = STATUS_SERIALIZE_ERROR; |
| 315 NotifyStoreError(); | 315 NotifyStoreError(); |
| 316 return; | 316 return; |
| 317 } | 317 } |
| 318 | 318 |
| 319 session_manager_client_->StorePolicyForUser( | 319 session_manager_client_->StorePolicyForUser( |
| 320 username_, | 320 username_, |
| 321 policy_blob, | 321 policy_blob, |
| 322 validator->policy()->new_public_key(), | |
| 323 base::Bind(&UserCloudPolicyStoreChromeOS::OnPolicyStored, | 322 base::Bind(&UserCloudPolicyStoreChromeOS::OnPolicyStored, |
| 324 weak_factory_.GetWeakPtr())); | 323 weak_factory_.GetWeakPtr())); |
| 325 } | 324 } |
| 326 | 325 |
| 327 void UserCloudPolicyStoreChromeOS::OnPolicyStored(bool success) { | 326 void UserCloudPolicyStoreChromeOS::OnPolicyStored(bool success) { |
| 328 if (!success) { | 327 if (!success) { |
| 329 status_ = STATUS_STORE_ERROR; | 328 status_ = STATUS_STORE_ERROR; |
| 330 NotifyStoreError(); | 329 NotifyStoreError(); |
| 331 } else { | 330 } else { |
| 332 // Load the policy right after storing it, to make sure it was accepted by | 331 // Load the policy right after storing it, to make sure it was accepted by |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 !sanitized_username.empty()) { | 559 !sanitized_username.empty()) { |
| 561 policy_key_path_ = user_policy_key_dir_.Append( | 560 policy_key_path_ = user_policy_key_dir_.Append( |
| 562 base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str())); | 561 base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str())); |
| 563 } else { | 562 } else { |
| 564 SampleValidationFailure(VALIDATION_FAILURE_DBUS); | 563 SampleValidationFailure(VALIDATION_FAILURE_DBUS); |
| 565 } | 564 } |
| 566 ReloadPolicyKey(callback); | 565 ReloadPolicyKey(callback); |
| 567 } | 566 } |
| 568 | 567 |
| 569 } // namespace policy | 568 } // namespace policy |
| OLD | NEW |