| 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(), |
| 322 base::Bind(&UserCloudPolicyStoreChromeOS::OnPolicyStored, | 323 base::Bind(&UserCloudPolicyStoreChromeOS::OnPolicyStored, |
| 323 weak_factory_.GetWeakPtr())); | 324 weak_factory_.GetWeakPtr())); |
| 324 } | 325 } |
| 325 | 326 |
| 326 void UserCloudPolicyStoreChromeOS::OnPolicyStored(bool success) { | 327 void UserCloudPolicyStoreChromeOS::OnPolicyStored(bool success) { |
| 327 if (!success) { | 328 if (!success) { |
| 328 status_ = STATUS_STORE_ERROR; | 329 status_ = STATUS_STORE_ERROR; |
| 329 NotifyStoreError(); | 330 NotifyStoreError(); |
| 330 } else { | 331 } else { |
| 331 // Load the policy right after storing it, to make sure it was accepted by | 332 // 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... |
| 559 !sanitized_username.empty()) { | 560 !sanitized_username.empty()) { |
| 560 policy_key_path_ = user_policy_key_dir_.Append( | 561 policy_key_path_ = user_policy_key_dir_.Append( |
| 561 base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str())); | 562 base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str())); |
| 562 } else { | 563 } else { |
| 563 SampleValidationFailure(VALIDATION_FAILURE_DBUS); | 564 SampleValidationFailure(VALIDATION_FAILURE_DBUS); |
| 564 } | 565 } |
| 565 ReloadPolicyKey(callback); | 566 ReloadPolicyKey(callback); |
| 566 } | 567 } |
| 567 | 568 |
| 568 } // namespace policy | 569 } // namespace policy |
| OLD | NEW |