keyboard_backlight_color_nudge_controller.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright 2022 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_KEYBOARD_BRIGHTNESS_KEYBOARD_BACKLIGHT_COLOR_NUDGE_CONTROLLER_H_
  5. #define ASH_SYSTEM_KEYBOARD_BRIGHTNESS_KEYBOARD_BACKLIGHT_COLOR_NUDGE_CONTROLLER_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/controls/contextual_nudge.h"
  8. #include "base/timer/timer.h"
  9. namespace views {
  10. class View;
  11. } // namespace views
  12. namespace ash {
  13. // Controller to manage keyboard backlight color education nudge.
  14. class ASH_EXPORT KeyboardBacklightColorNudgeController {
  15. public:
  16. KeyboardBacklightColorNudgeController();
  17. KeyboardBacklightColorNudgeController(
  18. const KeyboardBacklightColorNudgeController&) = delete;
  19. KeyboardBacklightColorNudgeController& operator=(
  20. const KeyboardBacklightColorNudgeController&) = delete;
  21. ~KeyboardBacklightColorNudgeController();
  22. // Determines whether the education nudge for wallpaper extracted color in the
  23. // personalization hub can be shown.
  24. static bool ShouldShowWallpaperColorNudge();
  25. // Called when the wallpaper color nudge is shown.
  26. static void HandleWallpaperColorNudgeShown();
  27. // Determines whether the education nudge can be shown and shows it.
  28. void MaybeShowEducationNudge(views::View* keyboard_brightness_slider_view);
  29. void CloseEducationNudge();
  30. // Called when the user has manually set the color.
  31. void SetUserPerformedAction();
  32. private:
  33. // Starts auto close timer.
  34. void StartAutoCloseTimer();
  35. base::OneShotTimer autoclose_;
  36. ContextualNudge* education_nudge_ = nullptr;
  37. base::WeakPtrFactory<KeyboardBacklightColorNudgeController> weak_factory_{
  38. this};
  39. };
  40. } // namespace ash
  41. #endif // ASH_SYSTEM_KEYBOARD_BRIGHTNESS_KEYBOARD_BACKLIGHT_COLOR_NUDGE_CONTROLLER_H_