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); |
224 | 225 |
225 // Posts tasks which return fake data to the UI thread. | 226 // This method is used to implement ReturnAsyncMethodResult. |
226 void ReturnAsyncMethodData(const AsyncMethodCallback& callback, | 227 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, |
227 const std::string& data); | 228 bool returns_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); | |
235 | 229 |
236 bool service_is_available_; | 230 bool service_is_available_; |
237 int async_call_id_; | 231 int async_call_id_; |
238 AsyncCallStatusHandler async_call_status_handler_; | 232 AsyncCallStatusHandler async_call_status_handler_; |
239 AsyncCallStatusWithDataHandler async_call_status_data_handler_; | 233 AsyncCallStatusWithDataHandler async_call_status_data_handler_; |
240 bool unmount_result_; | 234 bool unmount_result_; |
241 std::vector<uint8_t> system_salt_; | 235 std::vector<uint8_t> system_salt_; |
242 | 236 |
243 std::vector<WaitForServiceToBeAvailableCallback> | 237 std::vector<WaitForServiceToBeAvailableCallback> |
244 pending_wait_for_service_to_be_available_callbacks_; | 238 pending_wait_for_service_to_be_available_callbacks_; |
245 | 239 |
246 // A stub store for InstallAttributes, mapping an attribute name to the | 240 // A stub store for InstallAttributes, mapping an attribute name to the |
247 // associated data blob. Used to implement InstallAttributesSet and -Get. | 241 // associated data blob. Used to implement InstallAttributesSet and -Get. |
248 std::map<std::string, std::vector<uint8_t>> install_attrs_; | 242 std::map<std::string, std::vector<uint8_t>> install_attrs_; |
249 bool locked_; | 243 bool locked_; |
250 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; | 244 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; |
251 | 245 |
252 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); | 246 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); |
253 }; | 247 }; |
254 | 248 |
255 } // namespace chromeos | 249 } // namespace chromeos |
256 | 250 |
257 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 251 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |