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 "chromeos/dbus/cryptohome_client.h" | 5 #include "chromeos/dbus/cryptohome_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 cryptohome::kCryptohomeAsyncRemove); | 115 cryptohome::kCryptohomeAsyncRemove); |
116 dbus::MessageWriter writer(&method_call); | 116 dbus::MessageWriter writer(&method_call); |
117 writer.AppendString(username); | 117 writer.AppendString(username); |
118 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs , | 118 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs , |
119 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, | 119 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, |
120 weak_ptr_factory_.GetWeakPtr(), | 120 weak_ptr_factory_.GetWeakPtr(), |
121 callback)); | 121 callback)); |
122 } | 122 } |
123 | 123 |
124 // CryptohomeClient override. | 124 // CryptohomeClient override. |
| 125 void RenameCryptohome(const cryptohome::AccountIdentifier& id_from, |
| 126 const cryptohome::AccountIdentifier& id_to, |
| 127 const ProtobufMethodCallback& callback) override { |
| 128 const char* method_name = cryptohome::kCryptohomeRenameCryptohome; |
| 129 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, method_name); |
| 130 |
| 131 dbus::MessageWriter writer(&method_call); |
| 132 writer.AppendProtoAsArrayOfBytes(id_from); |
| 133 writer.AppendProtoAsArrayOfBytes(id_to); |
| 134 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs, |
| 135 base::Bind(&CryptohomeClientImpl::OnBaseReplyMethod, |
| 136 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 137 } |
| 138 |
| 139 // CryptohomeClient override. |
125 void GetSystemSalt(const GetSystemSaltCallback& callback) override { | 140 void GetSystemSalt(const GetSystemSaltCallback& callback) override { |
126 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, | 141 dbus::MethodCall method_call(cryptohome::kCryptohomeInterface, |
127 cryptohome::kCryptohomeGetSystemSalt); | 142 cryptohome::kCryptohomeGetSystemSalt); |
128 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs , | 143 proxy_->CallMethod(&method_call, kTpmDBusTimeoutMs , |
129 base::Bind(&CryptohomeClientImpl::OnGetSystemSalt, | 144 base::Bind(&CryptohomeClientImpl::OnGetSystemSalt, |
130 weak_ptr_factory_.GetWeakPtr(), | 145 weak_ptr_factory_.GetWeakPtr(), |
131 callback)); | 146 callback)); |
132 } | 147 } |
133 | 148 |
134 // CryptohomeClient override, | 149 // CryptohomeClient override, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 proxy_->CallMethod( | 344 proxy_->CallMethod( |
330 &method_call, kTpmDBusTimeoutMs , | 345 &method_call, kTpmDBusTimeoutMs , |
331 base::Bind( | 346 base::Bind( |
332 &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfo, | 347 &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfo, |
333 weak_ptr_factory_.GetWeakPtr(), | 348 weak_ptr_factory_.GetWeakPtr(), |
334 callback)); | 349 callback)); |
335 } | 350 } |
336 | 351 |
337 // CryptohomeClient override. | 352 // CryptohomeClient override. |
338 void Pkcs11GetTpmTokenInfoForUser( | 353 void Pkcs11GetTpmTokenInfoForUser( |
339 const std::string& user_email, | 354 const std::string& user_id, |
340 const Pkcs11GetTpmTokenInfoCallback& callback) override { | 355 const Pkcs11GetTpmTokenInfoCallback& callback) override { |
341 dbus::MethodCall method_call( | 356 dbus::MethodCall method_call( |
342 cryptohome::kCryptohomeInterface, | 357 cryptohome::kCryptohomeInterface, |
343 cryptohome::kCryptohomePkcs11GetTpmTokenInfoForUser); | 358 cryptohome::kCryptohomePkcs11GetTpmTokenInfoForUser); |
344 dbus::MessageWriter writer(&method_call); | 359 dbus::MessageWriter writer(&method_call); |
345 writer.AppendString(user_email); | 360 writer.AppendString(user_id); |
346 proxy_->CallMethod( | 361 proxy_->CallMethod( |
347 &method_call, kTpmDBusTimeoutMs , | 362 &method_call, kTpmDBusTimeoutMs , |
348 base::Bind( | 363 base::Bind( |
349 &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfoForUser, | 364 &CryptohomeClientImpl::OnPkcs11GetTpmTokenInfoForUser, |
350 weak_ptr_factory_.GetWeakPtr(), | 365 weak_ptr_factory_.GetWeakPtr(), |
351 callback)); | 366 callback)); |
352 } | 367 } |
353 | 368 |
354 // CryptohomeClient override. | 369 // CryptohomeClient override. |
355 bool InstallAttributesGet(const std::string& name, | 370 bool InstallAttributesGet(const std::string& name, |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 return new CryptohomeClientImpl(); | 1152 return new CryptohomeClientImpl(); |
1138 } | 1153 } |
1139 | 1154 |
1140 // static | 1155 // static |
1141 std::string CryptohomeClient::GetStubSanitizedUsername( | 1156 std::string CryptohomeClient::GetStubSanitizedUsername( |
1142 const std::string& username) { | 1157 const std::string& username) { |
1143 return username + kUserIdStubHashSuffix; | 1158 return username + kUserIdStubHashSuffix; |
1144 } | 1159 } |
1145 | 1160 |
1146 } // namespace chromeos | 1161 } // namespace chromeos |
OLD | NEW |