quiet_mode_feature_pod_controller.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2018 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_UNIFIED_QUIET_MODE_FEATURE_POD_CONTROLLER_H_
  5. #define ASH_SYSTEM_UNIFIED_QUIET_MODE_FEATURE_POD_CONTROLLER_H_
  6. #include <string>
  7. #include "ash/ash_export.h"
  8. #include "ash/public/cpp/notifier_settings_observer.h"
  9. #include "ash/system/unified/feature_pod_controller_base.h"
  10. #include "third_party/abseil-cpp/absl/types/optional.h"
  11. #include "ui/message_center/message_center_observer.h"
  12. namespace ash {
  13. class UnifiedSystemTrayController;
  14. // Controller of a feature pod button that toggles do-not-disturb mode.
  15. // If the do-not-disturb mode is enabled, the button indicates it by bright
  16. // background color and different icon.
  17. class ASH_EXPORT QuietModeFeaturePodController
  18. : public FeaturePodControllerBase,
  19. public message_center::MessageCenterObserver,
  20. public NotifierSettingsObserver {
  21. public:
  22. explicit QuietModeFeaturePodController(
  23. UnifiedSystemTrayController* tray_controller);
  24. QuietModeFeaturePodController(const QuietModeFeaturePodController&) = delete;
  25. QuietModeFeaturePodController& operator=(
  26. const QuietModeFeaturePodController&) = delete;
  27. ~QuietModeFeaturePodController() override;
  28. // FeaturePodControllerBase:
  29. FeaturePodButton* CreateButton() override;
  30. void OnIconPressed() override;
  31. void OnLabelPressed() override;
  32. SystemTrayItemUmaType GetUmaType() const override;
  33. // message_center::MessageCenterObserver:
  34. void OnQuietModeChanged(bool in_quiet_mode) override;
  35. // NotifierSettingsObserver:
  36. void OnNotifiersUpdated(
  37. const std::vector<NotifierMetadata>& notifiers) override;
  38. private:
  39. std::u16string GetQuietModeStateTooltip();
  40. void RecordDisabledNotifierCount(int disabled_count);
  41. UnifiedSystemTrayController* const tray_controller_;
  42. FeaturePodButton* button_ = nullptr;
  43. absl::optional<int> last_disabled_count_;
  44. };
  45. } // namespace ash
  46. #endif // ASH_SYSTEM_UNIFIED_QUIET_MODE_FEATURE_POD_CONTROLLER_H_