| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/fake_cryptohome_client.h" | 5 #include "chromeos/dbus/fake_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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "crypto/nss_util.h" | 10 #include "crypto/nss_util.h" |
| 11 #include "third_party/cros_system_api/dbus/service_constants.h" | 11 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 FakeCryptohomeClient::FakeCryptohomeClient() | 15 FakeCryptohomeClient::FakeCryptohomeClient() |
| 16 : service_is_available_(true), | 16 : service_is_available_(true), |
| 17 async_call_id_(1), | 17 async_call_id_(1), |
| 18 tpm_is_ready_counter_(0), | 18 tpm_is_ready_counter_(0), |
| 19 unmount_result_(true), | 19 unmount_result_(true), |
| 20 system_salt_(GetStubSystemSalt()), |
| 20 locked_(false), | 21 locked_(false), |
| 21 weak_ptr_factory_(this) {} | 22 weak_ptr_factory_(this) {} |
| 22 | 23 |
| 23 FakeCryptohomeClient::~FakeCryptohomeClient() {} | 24 FakeCryptohomeClient::~FakeCryptohomeClient() {} |
| 24 | 25 |
| 25 void FakeCryptohomeClient::Init(dbus::Bus* bus) { | 26 void FakeCryptohomeClient::Init(dbus::Bus* bus) { |
| 26 } | 27 } |
| 27 | 28 |
| 28 void FakeCryptohomeClient::SetAsyncCallStatusHandlers( | 29 void FakeCryptohomeClient::SetAsyncCallStatusHandlers( |
| 29 const AsyncCallStatusHandler& handler, | 30 const AsyncCallStatusHandler& handler, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 ReturnAsyncMethodResult(callback, false); | 74 ReturnAsyncMethodResult(callback, false); |
| 74 } | 75 } |
| 75 | 76 |
| 76 void FakeCryptohomeClient::AsyncRemove( | 77 void FakeCryptohomeClient::AsyncRemove( |
| 77 const std::string& username, | 78 const std::string& username, |
| 78 const AsyncMethodCallback& callback) { | 79 const AsyncMethodCallback& callback) { |
| 79 ReturnAsyncMethodResult(callback, false); | 80 ReturnAsyncMethodResult(callback, false); |
| 80 } | 81 } |
| 81 | 82 |
| 82 bool FakeCryptohomeClient::GetSystemSalt(std::vector<uint8>* salt) { | 83 bool FakeCryptohomeClient::GetSystemSalt(std::vector<uint8>* salt) { |
| 83 *salt = GetStubSystemSalt(); | 84 *salt = system_salt_; |
| 84 return true; | 85 return true; |
| 85 } | 86 } |
| 86 | 87 |
| 87 void FakeCryptohomeClient::GetSanitizedUsername( | 88 void FakeCryptohomeClient::GetSanitizedUsername( |
| 88 const std::string& username, | 89 const std::string& username, |
| 89 const StringDBusMethodCallback& callback) { | 90 const StringDBusMethodCallback& callback) { |
| 90 // Even for stub implementation we have to return different values so that | 91 // Even for stub implementation we have to return different values so that |
| 91 // multi-profiles would work. | 92 // multi-profiles would work. |
| 92 std::string sanitized_username = GetStubSanitizedUsername(username); | 93 std::string sanitized_username = GetStubSanitizedUsername(username); |
| 93 base::MessageLoop::current()->PostTask( | 94 base::MessageLoop::current()->PostTask( |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 FROM_HERE, | 424 FROM_HERE, |
| 424 base::Bind(async_call_status_data_handler_, | 425 base::Bind(async_call_status_data_handler_, |
| 425 async_call_id_, | 426 async_call_id_, |
| 426 true, | 427 true, |
| 427 std::string())); | 428 std::string())); |
| 428 } | 429 } |
| 429 ++async_call_id_; | 430 ++async_call_id_; |
| 430 } | 431 } |
| 431 | 432 |
| 432 } // namespace chromeos | 433 } // namespace chromeos |
| OLD | NEW |