notification_presenter.cc 862 B

12345678910111213141516171819202122232425262728293031
  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. #include "brightray/browser/notification_presenter.h"
  5. #include "brightray/browser/notification.h"
  6. namespace brightray {
  7. NotificationPresenter::NotificationPresenter() {}
  8. NotificationPresenter::~NotificationPresenter() {
  9. for (Notification* notification : notifications_)
  10. delete notification;
  11. }
  12. base::WeakPtr<Notification> NotificationPresenter::CreateNotification(
  13. NotificationDelegate* delegate) {
  14. Notification* notification = CreateNotificationObject(delegate);
  15. notifications_.insert(notification);
  16. return notification->GetWeakPtr();
  17. }
  18. void NotificationPresenter::RemoveNotification(Notification* notification) {
  19. notifications_.erase(notification);
  20. delete notification;
  21. }
  22. } // namespace brightray