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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 const cryptohome::AuthorizationRequest& auth, | 200 const cryptohome::AuthorizationRequest& auth, |
201 const VoidDBusMethodCallback& callback) override; | 201 const VoidDBusMethodCallback& callback) override; |
202 void SetDircryptoMigrationProgressHandler( | 202 void SetDircryptoMigrationProgressHandler( |
203 const DircryptoMigrationProgessHandler& handler) override; | 203 const DircryptoMigrationProgessHandler& handler) override; |
204 void RemoveFirmwareManagementParametersFromTpm( | 204 void RemoveFirmwareManagementParametersFromTpm( |
205 const cryptohome::RemoveFirmwareManagementParametersRequest& request, | 205 const cryptohome::RemoveFirmwareManagementParametersRequest& request, |
206 const ProtobufMethodCallback& callback) override; | 206 const ProtobufMethodCallback& callback) override; |
207 void SetFirmwareManagementParametersInTpm( | 207 void SetFirmwareManagementParametersInTpm( |
208 const cryptohome::SetFirmwareManagementParametersRequest& request, | 208 const cryptohome::SetFirmwareManagementParametersRequest& request, |
209 const ProtobufMethodCallback& callback) override; | 209 const ProtobufMethodCallback& callback) override; |
| 210 void NeedsDircryptoMigration(const cryptohome::Identification& cryptohome_id, |
| 211 const BoolDBusMethodCallback& callback) override; |
210 | 212 |
211 // Changes the behavior of WaitForServiceToBeAvailable(). This method runs | 213 // Changes the behavior of WaitForServiceToBeAvailable(). This method runs |
212 // pending callbacks if is_available is true. | 214 // pending callbacks if is_available is true. |
213 void SetServiceIsAvailable(bool is_available); | 215 void SetServiceIsAvailable(bool is_available); |
214 | 216 |
215 // Sets the unmount result of Unmount() call. | 217 // Sets the unmount result of Unmount() call. |
216 void set_unmount_result(bool result) { | 218 void set_unmount_result(bool result) { |
217 unmount_result_ = result; | 219 unmount_result_ = result; |
218 } | 220 } |
219 | 221 |
220 // Sets the system salt which will be returned from GetSystemSalt(). By | 222 // Sets the system salt which will be returned from GetSystemSalt(). By |
221 // default, GetSystemSalt() returns the value generated by | 223 // default, GetSystemSalt() returns the value generated by |
222 // GetStubSystemSalt(). | 224 // GetStubSystemSalt(). |
223 void set_system_salt(const std::vector<uint8_t>& system_salt) { | 225 void set_system_salt(const std::vector<uint8_t>& system_salt) { |
224 system_salt_ = system_salt; | 226 system_salt_ = system_salt; |
225 } | 227 } |
226 | 228 |
227 // Returns the stub system salt as raw bytes. (not as a string encoded in the | 229 // Returns the stub system salt as raw bytes. (not as a string encoded in the |
228 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). | 230 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). |
229 static std::vector<uint8_t> GetStubSystemSalt(); | 231 static std::vector<uint8_t> GetStubSystemSalt(); |
230 | 232 |
| 233 // Sets the needs dircrypto migration value. |
| 234 void set_needs_dircrypto_migration(bool needs_migration) { |
| 235 needs_dircrypto_migration_ = needs_migration; |
| 236 } |
| 237 |
231 private: | 238 private: |
232 void ReturnProtobufMethodCallback( | 239 void ReturnProtobufMethodCallback( |
233 const cryptohome::BaseReply& reply, | 240 const cryptohome::BaseReply& reply, |
234 const ProtobufMethodCallback& callback); | 241 const ProtobufMethodCallback& callback); |
235 | 242 |
236 // Posts tasks which return fake results to the UI thread. | 243 // Posts tasks which return fake results to the UI thread. |
237 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback); | 244 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback); |
238 | 245 |
239 // Posts tasks which return fake data to the UI thread. | 246 // Posts tasks which return fake data to the UI thread. |
240 void ReturnAsyncMethodData(const AsyncMethodCallback& callback, | 247 void ReturnAsyncMethodData(const AsyncMethodCallback& callback, |
(...skipping 22 matching lines...) Expand all Loading... |
263 | 270 |
264 // A stub store for InstallAttributes, mapping an attribute name to the | 271 // A stub store for InstallAttributes, mapping an attribute name to the |
265 // associated data blob. Used to implement InstallAttributesSet and -Get. | 272 // associated data blob. Used to implement InstallAttributesSet and -Get. |
266 std::map<std::string, std::vector<uint8_t>> install_attrs_; | 273 std::map<std::string, std::vector<uint8_t>> install_attrs_; |
267 bool locked_; | 274 bool locked_; |
268 | 275 |
269 DircryptoMigrationProgessHandler dircrypto_migration_progress_handler_; | 276 DircryptoMigrationProgessHandler dircrypto_migration_progress_handler_; |
270 base::RepeatingTimer dircrypto_migration_progress_timer_; | 277 base::RepeatingTimer dircrypto_migration_progress_timer_; |
271 uint64_t dircrypto_migration_progress_; | 278 uint64_t dircrypto_migration_progress_; |
272 | 279 |
| 280 bool needs_dircrypto_migration_ = false; |
| 281 |
273 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; | 282 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; |
274 | 283 |
275 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); | 284 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); |
276 }; | 285 }; |
277 | 286 |
278 } // namespace chromeos | 287 } // namespace chromeos |
279 | 288 |
280 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 289 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |