enable_hotspot_quick_action_controller.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_SYSTEM_PHONEHUB_ENABLE_HOTSPOT_QUICK_ACTION_CONTROLLER_H_
  5. #define ASH_SYSTEM_PHONEHUB_ENABLE_HOTSPOT_QUICK_ACTION_CONTROLLER_H_
  6. #include "ash/components/phonehub/tether_controller.h"
  7. #include "ash/system/phonehub/quick_action_controller_base.h"
  8. namespace ash {
  9. // Controller of a quick action item that toggles Locate phone mode.
  10. class EnableHotspotQuickActionController
  11. : public QuickActionControllerBase,
  12. public phonehub::TetherController::Observer {
  13. public:
  14. explicit EnableHotspotQuickActionController(
  15. phonehub::TetherController* tether_controller);
  16. ~EnableHotspotQuickActionController() override;
  17. EnableHotspotQuickActionController(EnableHotspotQuickActionController&) =
  18. delete;
  19. EnableHotspotQuickActionController operator=(
  20. EnableHotspotQuickActionController&) = delete;
  21. // QuickActionControllerBase:
  22. QuickActionItem* CreateItem() override;
  23. void OnButtonPressed(bool is_now_enabled) override;
  24. // phonehub::TetherController::Observer:
  25. void OnTetherStatusChanged() override;
  26. private:
  27. // All the possible states that the enable hotspot button can be viewed. Each
  28. // state has a corresponding icon, labels and tooltip view.
  29. enum class ActionState { kOff, kConnecting, kConnected, kNoReception };
  30. // Set the item (including icon, label and tooltips) to a certain state.
  31. void SetState(ActionState state);
  32. phonehub::TetherController* tether_controller_ = nullptr;
  33. QuickActionItem* item_ = nullptr;
  34. };
  35. } // namespace ash
  36. #endif // ASH_SYSTEM_PHONEHUB_ENABLE_HOTSPOT_QUICK_ACTION_CONTROLLER_H_