2015-12-25 02:16:07 +00:00
|
|
|
// Copyright (c) 2015 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2017-05-18 22:58:12 +00:00
|
|
|
#include "brightray/browser/notification_presenter.h"
|
2015-12-25 02:16:07 +00:00
|
|
|
|
2017-05-18 22:58:12 +00:00
|
|
|
#include "brightray/browser/notification.h"
|
2015-12-25 02:16:07 +00:00
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
2018-04-18 01:56:12 +00:00
|
|
|
NotificationPresenter::NotificationPresenter() {}
|
2015-12-25 02:16:07 +00:00
|
|
|
|
|
|
|
NotificationPresenter::~NotificationPresenter() {
|
|
|
|
for (Notification* notification : notifications_)
|
|
|
|
delete notification;
|
|
|
|
}
|
|
|
|
|
|
|
|
base::WeakPtr<Notification> NotificationPresenter::CreateNotification(
|
|
|
|
NotificationDelegate* delegate) {
|
2017-01-10 15:34:41 +00:00
|
|
|
Notification* notification = CreateNotificationObject(delegate);
|
2015-12-25 02:16:07 +00:00
|
|
|
notifications_.insert(notification);
|
|
|
|
return notification->GetWeakPtr();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotificationPresenter::RemoveNotification(Notification* notification) {
|
|
|
|
notifications_.erase(notification);
|
|
|
|
delete notification;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace brightray
|