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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 void FakeCryptohomeClient::RenameCryptohome( | 100 void FakeCryptohomeClient::RenameCryptohome( |
101 const cryptohome::Identification& cryptohome_id_from, | 101 const cryptohome::Identification& cryptohome_id_from, |
102 const cryptohome::Identification& cryptohome_id_to, | 102 const cryptohome::Identification& cryptohome_id_to, |
103 const ProtobufMethodCallback& callback) { | 103 const ProtobufMethodCallback& callback) { |
104 cryptohome::BaseReply reply; | 104 cryptohome::BaseReply reply; |
105 ReturnProtobufMethodCallback(reply, callback); | 105 ReturnProtobufMethodCallback(reply, callback); |
106 } | 106 } |
107 | 107 |
| 108 void FakeCryptohomeClient::GetAccountDiskUsage( |
| 109 const cryptohome::Identification& account_id, |
| 110 const ProtobufMethodCallback& callback) { |
| 111 cryptohome::BaseReply reply; |
| 112 cryptohome::GetAccountDiskUsageReply* get_account_disk_usage_reply = |
| 113 reply.MutableExtension(cryptohome::GetAccountDiskUsageReply::reply); |
| 114 // Sets 100 MB as a fake usage. |
| 115 get_account_disk_usage_reply->set_size(100 * 1024 * 1024); |
| 116 ReturnProtobufMethodCallback(reply, callback); |
| 117 } |
| 118 |
108 void FakeCryptohomeClient::GetSystemSalt( | 119 void FakeCryptohomeClient::GetSystemSalt( |
109 const GetSystemSaltCallback& callback) { | 120 const GetSystemSaltCallback& callback) { |
110 base::ThreadTaskRunnerHandle::Get()->PostTask( | 121 base::ThreadTaskRunnerHandle::Get()->PostTask( |
111 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, system_salt_)); | 122 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, system_salt_)); |
112 } | 123 } |
113 | 124 |
114 void FakeCryptohomeClient::GetSanitizedUsername( | 125 void FakeCryptohomeClient::GetSanitizedUsername( |
115 const cryptohome::Identification& cryptohome_id, | 126 const cryptohome::Identification& cryptohome_id, |
116 const StringDBusMethodCallback& callback) { | 127 const StringDBusMethodCallback& callback) { |
117 // Even for stub implementation we have to return different values so that | 128 // 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... |
595 cryptohome::MOUNT_ERROR_NONE)); | 606 cryptohome::MOUNT_ERROR_NONE)); |
596 } else if (returns_data && !async_call_status_data_handler_.is_null()) { | 607 } else if (returns_data && !async_call_status_data_handler_.is_null()) { |
597 base::ThreadTaskRunnerHandle::Get()->PostTask( | 608 base::ThreadTaskRunnerHandle::Get()->PostTask( |
598 FROM_HERE, base::Bind(async_call_status_data_handler_, async_call_id_, | 609 FROM_HERE, base::Bind(async_call_status_data_handler_, async_call_id_, |
599 true, std::string())); | 610 true, std::string())); |
600 } | 611 } |
601 ++async_call_id_; | 612 ++async_call_id_; |
602 } | 613 } |
603 | 614 |
604 } // namespace chromeos | 615 } // namespace chromeos |
OLD | NEW |