#ifndef ASH_SYSTEM_PHONEHUB_SILENCE_PHONE_QUICK_ACTION_CONTROLLER_H_
#define ASH_SYSTEM_PHONEHUB_SILENCE_PHONE_QUICK_ACTION_CONTROLLER_H_
#include "ash/system/phonehub/quick_action_controller_base.h"
#include "base/memory/raw_ptr.h"
#include "chromeos/ash/components/phonehub/do_not_disturb_controller.h"
namespace base {
class OneShotTimer;
}
namespace ash {
class ASH_EXPORT SilencePhoneQuickActionController
: public QuickActionControllerBase,
public phonehub::DoNotDisturbController::Observer {
public:
explicit SilencePhoneQuickActionController(
phonehub::DoNotDisturbController* dnd_controller);
~SilencePhoneQuickActionController() override;
SilencePhoneQuickActionController(SilencePhoneQuickActionController&) =
delete;
SilencePhoneQuickActionController operator=(
SilencePhoneQuickActionController&) = delete;
bool IsItemEnabled();
QuickActionItem* CreateItem() override;
void OnButtonPressed(bool is_now_enabled) override;
void UpdateQuickActionItemUi() override;
void OnDndStateChanged() override;
private:
friend class SilencePhoneQuickActionControllerTest;
enum class ActionState { kOff, kOn, kDisabled };
void SetItemState(ActionState state);
ActionState GetItemState();
void CheckRequestedState();
raw_ptr<phonehub::DoNotDisturbController> dnd_controller_ = nullptr;
raw_ptr<QuickActionItem, DanglingUntriaged> item_ = nullptr;
ActionState state_;
std::optional<ActionState> requested_state_;
std::unique_ptr<base::OneShotTimer> check_requested_state_timer_;
};
}
#endif