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