notification_presenter.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright (c) 2015 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_
  5. #define BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_
  6. #include <set>
  7. #include "base/memory/weak_ptr.h"
  8. namespace brightray {
  9. class Notification;
  10. class NotificationDelegate;
  11. class NotificationPresenter {
  12. public:
  13. static NotificationPresenter* Create();
  14. virtual ~NotificationPresenter();
  15. base::WeakPtr<Notification> CreateNotification(
  16. NotificationDelegate* delegate);
  17. std::set<Notification*> notifications() const { return notifications_; }
  18. protected:
  19. NotificationPresenter();
  20. virtual Notification* CreateNotificationObject(
  21. NotificationDelegate* delegate) = 0;
  22. private:
  23. friend class Notification;
  24. void RemoveNotification(Notification* notification);
  25. std::set<Notification*> notifications_;
  26. DISALLOW_COPY_AND_ASSIGN(NotificationPresenter);
  27. };
  28. } // namespace brightray
  29. #endif // BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_