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 #ifndef CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
6 #define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Returns the stub system salt as raw bytes. (not as a string encoded in the | 213 // Returns the stub system salt as raw bytes. (not as a string encoded in the |
214 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). | 214 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). |
215 static std::vector<uint8_t> GetStubSystemSalt(); | 215 static std::vector<uint8_t> GetStubSystemSalt(); |
216 | 216 |
217 private: | 217 private: |
218 void ReturnProtobufMethodCallback( | 218 void ReturnProtobufMethodCallback( |
219 const cryptohome::BaseReply& reply, | 219 const cryptohome::BaseReply& reply, |
220 const ProtobufMethodCallback& callback); | 220 const ProtobufMethodCallback& callback); |
221 | 221 |
222 // Posts tasks which return fake results to the UI thread. | 222 // Posts tasks which return fake results to the UI thread. |
223 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback, | 223 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback); |
224 bool returns_data); | |
225 | 224 |
226 // This method is used to implement ReturnAsyncMethodResult. | 225 // Posts tasks which return fake data to the UI thread. |
227 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, | 226 void ReturnAsyncMethodData(const AsyncMethodCallback& callback, |
228 bool returns_data); | 227 const std::string& data); |
| 228 |
| 229 // This method is used to implement ReturnAsyncMethodResult without data. |
| 230 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback); |
| 231 |
| 232 // This method is used to implement ReturnAsyncMethodResult with data. |
| 233 void ReturnAsyncMethodDataInternal(const AsyncMethodCallback& callback, |
| 234 const std::string& data); |
229 | 235 |
230 bool service_is_available_; | 236 bool service_is_available_; |
231 int async_call_id_; | 237 int async_call_id_; |
232 AsyncCallStatusHandler async_call_status_handler_; | 238 AsyncCallStatusHandler async_call_status_handler_; |
233 AsyncCallStatusWithDataHandler async_call_status_data_handler_; | 239 AsyncCallStatusWithDataHandler async_call_status_data_handler_; |
234 bool unmount_result_; | 240 bool unmount_result_; |
235 std::vector<uint8_t> system_salt_; | 241 std::vector<uint8_t> system_salt_; |
236 | 242 |
237 std::vector<WaitForServiceToBeAvailableCallback> | 243 std::vector<WaitForServiceToBeAvailableCallback> |
238 pending_wait_for_service_to_be_available_callbacks_; | 244 pending_wait_for_service_to_be_available_callbacks_; |
239 | 245 |
240 // A stub store for InstallAttributes, mapping an attribute name to the | 246 // A stub store for InstallAttributes, mapping an attribute name to the |
241 // associated data blob. Used to implement InstallAttributesSet and -Get. | 247 // associated data blob. Used to implement InstallAttributesSet and -Get. |
242 std::map<std::string, std::vector<uint8_t>> install_attrs_; | 248 std::map<std::string, std::vector<uint8_t>> install_attrs_; |
243 bool locked_; | 249 bool locked_; |
244 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; | 250 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; |
245 | 251 |
246 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); | 252 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); |
247 }; | 253 }; |
248 | 254 |
249 } // namespace chromeos | 255 } // namespace chromeos |
250 | 256 |
251 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 257 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |