| 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 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chromeos/dbus/cryptohome_client.h" | 14 #include "chromeos/dbus/cryptohome_client.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient { | 18 class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient { |
| 19 public: | 19 public: |
| 20 FakeCryptohomeClient(); | 20 FakeCryptohomeClient(); |
| 21 ~FakeCryptohomeClient() override; | 21 ~FakeCryptohomeClient() override; |
| 22 | 22 |
| 23 void Init(dbus::Bus* bus) override; | 23 void Init(dbus::Bus* bus) override; |
| 24 void SetAsyncCallStatusHandlers( | 24 void SetAsyncCallStatusHandlers( |
| 25 const AsyncCallStatusHandler& handler, | 25 const AsyncCallStatusHandler& handler, |
| 26 const AsyncCallStatusWithDataHandler& data_handler) override; | 26 const AsyncCallStatusWithDataHandler& data_handler) override; |
| 27 void ResetAsyncCallStatusHandlers() override; | 27 void ResetAsyncCallStatusHandlers() override; |
| 28 void SetLowDiskSpaceHandler(const LowDiskSpaceHandler& handler) override; |
| 29 void ResetLowDiskSpaceHandler() override; |
| 28 void WaitForServiceToBeAvailable( | 30 void WaitForServiceToBeAvailable( |
| 29 const WaitForServiceToBeAvailableCallback& callback) override; | 31 const WaitForServiceToBeAvailableCallback& callback) override; |
| 30 void IsMounted(const BoolDBusMethodCallback& callback) override; | 32 void IsMounted(const BoolDBusMethodCallback& callback) override; |
| 31 bool Unmount(bool* success) override; | 33 bool Unmount(bool* success) override; |
| 32 void AsyncCheckKey(const cryptohome::Identification& cryptohome_id, | 34 void AsyncCheckKey(const cryptohome::Identification& cryptohome_id, |
| 33 const std::string& key, | 35 const std::string& key, |
| 34 const AsyncMethodCallback& callback) override; | 36 const AsyncMethodCallback& callback) override; |
| 35 void AsyncMigrateKey(const cryptohome::Identification& cryptohome_id, | 37 void AsyncMigrateKey(const cryptohome::Identification& cryptohome_id, |
| 36 const std::string& from_key, | 38 const std::string& from_key, |
| 37 const std::string& to_key, | 39 const std::string& to_key, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 bool returns_data); | 223 bool returns_data); |
| 222 | 224 |
| 223 // This method is used to implement ReturnAsyncMethodResult. | 225 // This method is used to implement ReturnAsyncMethodResult. |
| 224 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, | 226 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, |
| 225 bool returns_data); | 227 bool returns_data); |
| 226 | 228 |
| 227 bool service_is_available_; | 229 bool service_is_available_; |
| 228 int async_call_id_; | 230 int async_call_id_; |
| 229 AsyncCallStatusHandler async_call_status_handler_; | 231 AsyncCallStatusHandler async_call_status_handler_; |
| 230 AsyncCallStatusWithDataHandler async_call_status_data_handler_; | 232 AsyncCallStatusWithDataHandler async_call_status_data_handler_; |
| 233 LowDiskSpaceHandler low_disk_space_handler_; |
| 231 bool unmount_result_; | 234 bool unmount_result_; |
| 232 std::vector<uint8_t> system_salt_; | 235 std::vector<uint8_t> system_salt_; |
| 233 | 236 |
| 234 std::vector<WaitForServiceToBeAvailableCallback> | 237 std::vector<WaitForServiceToBeAvailableCallback> |
| 235 pending_wait_for_service_to_be_available_callbacks_; | 238 pending_wait_for_service_to_be_available_callbacks_; |
| 236 | 239 |
| 237 // A stub store for InstallAttributes, mapping an attribute name to the | 240 // A stub store for InstallAttributes, mapping an attribute name to the |
| 238 // associated data blob. Used to implement InstallAttributesSet and -Get. | 241 // associated data blob. Used to implement InstallAttributesSet and -Get. |
| 239 std::map<std::string, std::vector<uint8_t>> install_attrs_; | 242 std::map<std::string, std::vector<uint8_t>> install_attrs_; |
| 240 bool locked_; | 243 bool locked_; |
| 241 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; | 244 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; |
| 242 | 245 |
| 243 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); | 246 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); |
| 244 }; | 247 }; |
| 245 | 248 |
| 246 } // namespace chromeos | 249 } // namespace chromeos |
| 247 | 250 |
| 248 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 251 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |