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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/timer/timer.h" |
16 #include "chromeos/dbus/cryptohome_client.h" | 17 #include "chromeos/dbus/cryptohome_client.h" |
17 | 18 |
18 namespace chromeos { | 19 namespace chromeos { |
19 | 20 |
20 class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient { | 21 class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient { |
21 public: | 22 public: |
22 FakeCryptohomeClient(); | 23 FakeCryptohomeClient(); |
23 ~FakeCryptohomeClient() override; | 24 ~FakeCryptohomeClient() override; |
24 | 25 |
25 void Init(dbus::Bus* bus) override; | 26 void Init(dbus::Bus* bus) override; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void ReturnAsyncMethodData(const AsyncMethodCallback& callback, | 234 void ReturnAsyncMethodData(const AsyncMethodCallback& callback, |
234 const std::string& data); | 235 const std::string& data); |
235 | 236 |
236 // This method is used to implement ReturnAsyncMethodResult without data. | 237 // This method is used to implement ReturnAsyncMethodResult without data. |
237 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback); | 238 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback); |
238 | 239 |
239 // This method is used to implement ReturnAsyncMethodResult with data. | 240 // This method is used to implement ReturnAsyncMethodResult with data. |
240 void ReturnAsyncMethodDataInternal(const AsyncMethodCallback& callback, | 241 void ReturnAsyncMethodDataInternal(const AsyncMethodCallback& callback, |
241 const std::string& data); | 242 const std::string& data); |
242 | 243 |
| 244 // This method is used to implement MigrateToDircrypto with simulated progress |
| 245 // updates. |
| 246 void OnDircryptoMigrationProgressUpdated(); |
| 247 |
243 bool service_is_available_; | 248 bool service_is_available_; |
244 int async_call_id_; | 249 int async_call_id_; |
245 AsyncCallStatusHandler async_call_status_handler_; | 250 AsyncCallStatusHandler async_call_status_handler_; |
246 AsyncCallStatusWithDataHandler async_call_status_data_handler_; | 251 AsyncCallStatusWithDataHandler async_call_status_data_handler_; |
247 bool unmount_result_; | 252 bool unmount_result_; |
248 std::vector<uint8_t> system_salt_; | 253 std::vector<uint8_t> system_salt_; |
249 | 254 |
250 std::vector<WaitForServiceToBeAvailableCallback> | 255 std::vector<WaitForServiceToBeAvailableCallback> |
251 pending_wait_for_service_to_be_available_callbacks_; | 256 pending_wait_for_service_to_be_available_callbacks_; |
252 | 257 |
253 // A stub store for InstallAttributes, mapping an attribute name to the | 258 // A stub store for InstallAttributes, mapping an attribute name to the |
254 // associated data blob. Used to implement InstallAttributesSet and -Get. | 259 // associated data blob. Used to implement InstallAttributesSet and -Get. |
255 std::map<std::string, std::vector<uint8_t>> install_attrs_; | 260 std::map<std::string, std::vector<uint8_t>> install_attrs_; |
256 bool locked_; | 261 bool locked_; |
| 262 |
| 263 DircryptoMigrationProgessHandler dircrypto_migration_progress_handler_; |
| 264 base::RepeatingTimer dircrypto_migration_progress_timer_; |
| 265 uint64_t dircrypto_migration_progress_; |
| 266 |
257 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; | 267 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; |
258 | 268 |
259 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); | 269 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); |
260 }; | 270 }; |
261 | 271 |
262 } // namespace chromeos | 272 } // namespace chromeos |
263 | 273 |
264 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 274 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |