blob: fc7a9f9c7a7c7c2e6bd4c1a212924ec993b83934 [file] [log] [blame]
// Copyright 2021 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef RMAD_STATE_HANDLER_DEVICE_DESTINATION_STATE_HANDLER_H_
#define RMAD_STATE_HANDLER_DEVICE_DESTINATION_STATE_HANDLER_H_
#include <memory>
#include "rmad/state_handler/base_state_handler.h"
#include "rmad/system/cryptohome_client.h"
#include "rmad/utils/cr50_utils.h"
#include "rmad/utils/crossystem_utils.h"
namespace rmad {
class DeviceDestinationStateHandler : public BaseStateHandler {
public:
explicit DeviceDestinationStateHandler(scoped_refptr<JsonStore> json_store);
// Used to inject mock |cryptohome_client_|, |cr50_utils_| and
// |crossystem_utils_| for testing.
DeviceDestinationStateHandler(
scoped_refptr<JsonStore> json_store,
std::unique_ptr<CryptohomeClient> cryptohome_client,
std::unique_ptr<Cr50Utils> cr50_utils,
std::unique_ptr<CrosSystemUtils> crossystem_utils);
ASSIGN_STATE(RmadState::StateCase::kDeviceDestination);
SET_REPEATABLE;
RmadErrorCode InitializeState() override;
GetNextStateCaseReply GetNextStateCase(const RmadState& state) override;
protected:
~DeviceDestinationStateHandler() override = default;
private:
bool ReplacedComponentNeedHwwpDisabled() const;
std::unique_ptr<CryptohomeClient> cryptohome_client_;
std::unique_ptr<Cr50Utils> cr50_utils_;
std::unique_ptr<CrosSystemUtils> crossystem_utils_;
};
namespace fake {
class FakeDeviceDestinationStateHandler : public DeviceDestinationStateHandler {
public:
FakeDeviceDestinationStateHandler(scoped_refptr<JsonStore> json_store,
const base::FilePath& working_dir_path);
protected:
~FakeDeviceDestinationStateHandler() override = default;
};
} // namespace fake
} // namespace rmad
#endif // RMAD_STATE_HANDLER_DEVICE_DESTINATION_STATE_HANDLER_H_