| 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 <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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const cryptohome::Identification& account_id, | 109 const cryptohome::Identification& account_id, |
| 110 const ProtobufMethodCallback& callback) { | 110 const ProtobufMethodCallback& callback) { |
| 111 cryptohome::BaseReply reply; | 111 cryptohome::BaseReply reply; |
| 112 cryptohome::GetAccountDiskUsageReply* get_account_disk_usage_reply = | 112 cryptohome::GetAccountDiskUsageReply* get_account_disk_usage_reply = |
| 113 reply.MutableExtension(cryptohome::GetAccountDiskUsageReply::reply); | 113 reply.MutableExtension(cryptohome::GetAccountDiskUsageReply::reply); |
| 114 // Sets 100 MB as a fake usage. | 114 // Sets 100 MB as a fake usage. |
| 115 get_account_disk_usage_reply->set_size(100 * 1024 * 1024); | 115 get_account_disk_usage_reply->set_size(100 * 1024 * 1024); |
| 116 ReturnProtobufMethodCallback(reply, callback); | 116 ReturnProtobufMethodCallback(reply, callback); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void FakeCryptohomeClient::GetFreeDiskSpace( |
| 120 const GetFreeDiskSpaceCallback& callback) { |
| 121 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 122 FROM_HERE, |
| 123 base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, 100 * 1024 * 1024)); |
| 124 } |
| 125 |
| 119 void FakeCryptohomeClient::GetSystemSalt( | 126 void FakeCryptohomeClient::GetSystemSalt( |
| 120 const GetSystemSaltCallback& callback) { | 127 const GetSystemSaltCallback& callback) { |
| 121 base::ThreadTaskRunnerHandle::Get()->PostTask( | 128 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 122 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, system_salt_)); | 129 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, system_salt_)); |
| 123 } | 130 } |
| 124 | 131 |
| 125 void FakeCryptohomeClient::GetSanitizedUsername( | 132 void FakeCryptohomeClient::GetSanitizedUsername( |
| 126 const cryptohome::Identification& cryptohome_id, | 133 const cryptohome::Identification& cryptohome_id, |
| 127 const StringDBusMethodCallback& callback) { | 134 const StringDBusMethodCallback& callback) { |
| 128 // Even for stub implementation we have to return different values so that | 135 // Even for stub implementation we have to return different values so that |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 cryptohome::MOUNT_ERROR_NONE)); | 613 cryptohome::MOUNT_ERROR_NONE)); |
| 607 } else if (returns_data && !async_call_status_data_handler_.is_null()) { | 614 } else if (returns_data && !async_call_status_data_handler_.is_null()) { |
| 608 base::ThreadTaskRunnerHandle::Get()->PostTask( | 615 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 609 FROM_HERE, base::Bind(async_call_status_data_handler_, async_call_id_, | 616 FROM_HERE, base::Bind(async_call_status_data_handler_, async_call_id_, |
| 610 true, std::string())); | 617 true, std::string())); |
| 611 } | 618 } |
| 612 ++async_call_id_; | 619 ++async_call_id_; |
| 613 } | 620 } |
| 614 | 621 |
| 615 } // namespace chromeos | 622 } // namespace chromeos |
| OLD | NEW |