dual_role_notification.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2015 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_POWER_DUAL_ROLE_NOTIFICATION_H_
  5. #define ASH_SYSTEM_POWER_DUAL_ROLE_NOTIFICATION_H_
  6. #include <stddef.h>
  7. #include <memory>
  8. #include "ash/ash_export.h"
  9. #include "ash/system/power/power_status.h"
  10. namespace message_center {
  11. class MessageCenter;
  12. class Notification;
  13. }
  14. namespace ash {
  15. // Shows a non-toasting MessageCenter notification based on what dual-role
  16. // devices are connected.
  17. class ASH_EXPORT DualRoleNotification {
  18. public:
  19. explicit DualRoleNotification(message_center::MessageCenter* message_center);
  20. DualRoleNotification(const DualRoleNotification&) = delete;
  21. DualRoleNotification& operator=(const DualRoleNotification&) = delete;
  22. ~DualRoleNotification();
  23. // Creates or updates the notification.
  24. void Update();
  25. private:
  26. // Creates the notification using the updated status.
  27. std::unique_ptr<message_center::Notification> CreateNotification();
  28. message_center::MessageCenter* message_center_;
  29. std::unique_ptr<PowerStatus::PowerSource> dual_role_source_;
  30. std::unique_ptr<PowerStatus::PowerSource> dual_role_sink_;
  31. size_t num_dual_role_sinks_;
  32. bool line_power_connected_;
  33. };
  34. } // namespace ash
  35. #endif // ASH_SYSTEM_POWER_DUAL_ROLE_NOTIFICATION_H_