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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 cryptohome::kCryptohomeTpmIsAttestationEnrolled); | 431 cryptohome::kCryptohomeTpmIsAttestationEnrolled); |
432 return CallBoolMethod(&method_call, callback); | 432 return CallBoolMethod(&method_call, callback); |
433 } | 433 } |
434 | 434 |
435 // CryptohomeClient override. | 435 // CryptohomeClient override. |
436 virtual void AsyncTpmAttestationCreateEnrollRequest( | 436 virtual void AsyncTpmAttestationCreateEnrollRequest( |
437 attestation::PrivacyCAType pca_type, | 437 attestation::PrivacyCAType pca_type, |
438 const AsyncMethodCallback& callback) OVERRIDE { | 438 const AsyncMethodCallback& callback) OVERRIDE { |
439 dbus::MethodCall method_call( | 439 dbus::MethodCall method_call( |
440 cryptohome::kCryptohomeInterface, | 440 cryptohome::kCryptohomeInterface, |
441 cryptohome::kCryptohomeAsyncTpmAttestationCreateEnrollRequestNew); | 441 cryptohome::kCryptohomeAsyncTpmAttestationCreateEnrollRequest); |
442 dbus::MessageWriter writer(&method_call); | 442 dbus::MessageWriter writer(&method_call); |
443 writer.AppendInt32(pca_type); | 443 writer.AppendInt32(pca_type); |
444 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 444 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
445 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, | 445 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, |
446 weak_ptr_factory_.GetWeakPtr(), | 446 weak_ptr_factory_.GetWeakPtr(), |
447 callback)); | 447 callback)); |
448 } | 448 } |
449 | 449 |
450 // CryptohomeClient override. | 450 // CryptohomeClient override. |
451 virtual void AsyncTpmAttestationEnroll( | 451 virtual void AsyncTpmAttestationEnroll( |
452 attestation::PrivacyCAType pca_type, | 452 attestation::PrivacyCAType pca_type, |
453 const std::string& pca_response, | 453 const std::string& pca_response, |
454 const AsyncMethodCallback& callback) OVERRIDE { | 454 const AsyncMethodCallback& callback) OVERRIDE { |
455 dbus::MethodCall method_call( | 455 dbus::MethodCall method_call( |
456 cryptohome::kCryptohomeInterface, | 456 cryptohome::kCryptohomeInterface, |
457 cryptohome::kCryptohomeAsyncTpmAttestationEnrollNew); | 457 cryptohome::kCryptohomeAsyncTpmAttestationEnroll); |
458 dbus::MessageWriter writer(&method_call); | 458 dbus::MessageWriter writer(&method_call); |
459 writer.AppendInt32(pca_type); | 459 writer.AppendInt32(pca_type); |
460 writer.AppendArrayOfBytes( | 460 writer.AppendArrayOfBytes( |
461 reinterpret_cast<const uint8*>(pca_response.data()), | 461 reinterpret_cast<const uint8*>(pca_response.data()), |
462 pca_response.size()); | 462 pca_response.size()); |
463 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 463 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
464 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, | 464 base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall, |
465 weak_ptr_factory_.GetWeakPtr(), | 465 weak_ptr_factory_.GetWeakPtr(), |
466 callback)); | 466 callback)); |
467 } | 467 } |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 return new CryptohomeClientImpl(); | 1074 return new CryptohomeClientImpl(); |
1075 } | 1075 } |
1076 | 1076 |
1077 // static | 1077 // static |
1078 std::string CryptohomeClient::GetStubSanitizedUsername( | 1078 std::string CryptohomeClient::GetStubSanitizedUsername( |
1079 const std::string& username) { | 1079 const std::string& username) { |
1080 return username + kUserIdStubHashSuffix; | 1080 return username + kUserIdStubHashSuffix; |
1081 } | 1081 } |
1082 | 1082 |
1083 } // namespace chromeos | 1083 } // namespace chromeos |
OLD | NEW |