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