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.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_NOTIFICATIONS_NOTIFICATION_PRESENTER_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_NOTIFICATIONS_NOTIFICATION_PRESENTER_H_
|
2013-03-28 21:49:29 +00:00
|
|
|
|
2015-12-25 02:16:07 +00:00
|
|
|
#include <set>
|
2018-04-08 19:24:08 +00:00
|
|
|
#include <string>
|
2015-04-20 20:20:50 +00:00
|
|
|
|
2015-12-25 02:16:07 +00:00
|
|
|
#include "base/memory/weak_ptr.h"
|
2013-03-28 21:49:29 +00:00
|
|
|
|
2018-10-17 18:01:11 +00:00
|
|
|
namespace electron {
|
2013-03-28 21:49:29 +00:00
|
|
|
|
2015-12-25 02:16:07 +00:00
|
|
|
class Notification;
|
|
|
|
class NotificationDelegate;
|
|
|
|
|
2013-03-28 21:49:29 +00:00
|
|
|
class NotificationPresenter {
|
|
|
|
public:
|
2013-03-28 22:03:58 +00:00
|
|
|
static NotificationPresenter* Create();
|
|
|
|
|
2015-12-25 02:16:07 +00:00
|
|
|
virtual ~NotificationPresenter();
|
|
|
|
|
|
|
|
base::WeakPtr<Notification> CreateNotification(
|
2018-04-08 19:24:08 +00:00
|
|
|
NotificationDelegate* delegate,
|
|
|
|
const std::string& notification_id);
|
|
|
|
void CloseNotificationWithId(const std::string& notification_id);
|
2015-12-25 02:16:07 +00:00
|
|
|
|
|
|
|
std::set<Notification*> notifications() const { return notifications_; }
|
|
|
|
|
2021-11-03 11:41:45 +00:00
|
|
|
// disable copy
|
|
|
|
NotificationPresenter(const NotificationPresenter&) = delete;
|
|
|
|
NotificationPresenter& operator=(const NotificationPresenter&) = delete;
|
|
|
|
|
2015-12-25 02:16:07 +00:00
|
|
|
protected:
|
|
|
|
NotificationPresenter();
|
2017-04-03 08:38:21 +00:00
|
|
|
virtual Notification* CreateNotificationObject(
|
|
|
|
NotificationDelegate* delegate) = 0;
|
2015-12-25 02:16:07 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
friend class Notification;
|
|
|
|
|
|
|
|
void RemoveNotification(Notification* notification);
|
|
|
|
|
|
|
|
std::set<Notification*> notifications_;
|
2013-03-28 21:49:29 +00:00
|
|
|
};
|
|
|
|
|
2018-10-17 18:01:11 +00:00
|
|
|
} // namespace electron
|
2013-03-28 21:49:29 +00:00
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_BROWSER_NOTIFICATIONS_NOTIFICATION_PRESENTER_H_
|