session_limit_notification_controller.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2014 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_SESSION_SESSION_LIMIT_NOTIFICATION_CONTROLLER_H_
  5. #define ASH_SYSTEM_SESSION_SESSION_LIMIT_NOTIFICATION_CONTROLLER_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/system/model/session_length_limit_model.h"
  8. namespace ash {
  9. class ASH_EXPORT SessionLimitNotificationController
  10. : public SessionLengthLimitModel::Observer {
  11. public:
  12. SessionLimitNotificationController();
  13. SessionLimitNotificationController(
  14. const SessionLimitNotificationController&) = delete;
  15. SessionLimitNotificationController& operator=(
  16. const SessionLimitNotificationController&) = delete;
  17. ~SessionLimitNotificationController() override;
  18. // SessionLengthLimitModel::Observer:
  19. void OnSessionLengthLimitUpdated() override;
  20. private:
  21. friend class SessionLimitNotificationControllerTest;
  22. void UpdateNotification();
  23. std::u16string ComposeNotificationTitle() const;
  24. static const char kNotificationId[];
  25. // Unowned.
  26. SessionLengthLimitModel* const model_;
  27. // LimitState of the last time OnSessionLengthLimitUpdate() is called.
  28. SessionLengthLimitModel::LimitState last_limit_state_ =
  29. SessionLengthLimitModel::LIMIT_NONE;
  30. bool has_notification_been_shown_ = false;
  31. };
  32. } // namespace ash
  33. #endif // ASH_SYSTEM_SESSION_SESSION_LIMIT_NOTIFICATION_CONTROLLER_H_