| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/consumer_management_service.h" | 5 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void ConsumerManagementService::GetOwner(const GetOwnerCallback& callback) { | 114 void ConsumerManagementService::GetOwner(const GetOwnerCallback& callback) { |
| 115 cryptohome::GetBootAttributeRequest request; | 115 cryptohome::GetBootAttributeRequest request; |
| 116 request.set_name(kAttributeOwnerId); | 116 request.set_name(kAttributeOwnerId); |
| 117 client_->GetBootAttribute( | 117 client_->GetBootAttribute( |
| 118 request, | 118 request, |
| 119 base::Bind(&ConsumerManagementService::OnGetBootAttributeDone, | 119 base::Bind(&ConsumerManagementService::OnGetBootAttributeDone, |
| 120 weak_ptr_factory_.GetWeakPtr(), | 120 weak_ptr_factory_.GetWeakPtr(), |
| 121 callback)); | 121 callback)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void ConsumerManagementService::SetOwner(const std::string& user_id, | 124 void ConsumerManagementService::SetOwner(const user_manager::UserID& user_id, |
| 125 const SetOwnerCallback& callback) { | 125 const SetOwnerCallback& callback) { |
| 126 const std::string& user_email = user_id.GetUserEmail(); |
| 126 cryptohome::SetBootAttributeRequest request; | 127 cryptohome::SetBootAttributeRequest request; |
| 127 request.set_name(kAttributeOwnerId); | 128 request.set_name(kAttributeOwnerId); |
| 128 request.set_value(user_id.data(), user_id.size()); | 129 request.set_value(user_email.data(), user_email.size()); |
| 129 client_->SetBootAttribute( | 130 client_->SetBootAttribute( |
| 130 request, | 131 request, |
| 131 base::Bind(&ConsumerManagementService::OnSetBootAttributeDone, | 132 base::Bind(&ConsumerManagementService::OnSetBootAttributeDone, |
| 132 weak_ptr_factory_.GetWeakPtr(), | 133 weak_ptr_factory_.GetWeakPtr(), |
| 133 callback)); | 134 callback)); |
| 134 } | 135 } |
| 135 | 136 |
| 136 void ConsumerManagementService::OwnershipStatusChanged() { | 137 void ConsumerManagementService::OwnershipStatusChanged() { |
| 137 } | 138 } |
| 138 | 139 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 if (!dbus_success || reply.error() != 0) { | 191 if (!dbus_success || reply.error() != 0) { |
| 191 LOG(ERROR) << "Failed to flush and sign boot lockbox."; | 192 LOG(ERROR) << "Failed to flush and sign boot lockbox."; |
| 192 callback.Run(false); | 193 callback.Run(false); |
| 193 return; | 194 return; |
| 194 } | 195 } |
| 195 | 196 |
| 196 callback.Run(true); | 197 callback.Run(true); |
| 197 } | 198 } |
| 198 | 199 |
| 199 } // namespace policy | 200 } // namespace policy |
| OLD | NEW |