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.
|
|
|
|
|
2013-03-28 21:49:29 +00:00
|
|
|
#ifndef BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_
|
|
|
|
#define BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_
|
|
|
|
|
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
|
|
|
|
|
|
|
namespace brightray {
|
|
|
|
|
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_; }
|
|
|
|
|
|
|
|
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_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(NotificationPresenter);
|
2013-03-28 21:49:29 +00:00
|
|
|
};
|
|
|
|
|
2013-11-17 23:20:17 +00:00
|
|
|
} // namespace brightray
|
2013-03-28 21:49:29 +00:00
|
|
|
|
2017-05-18 22:05:25 +00:00
|
|
|
#endif // BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_H_
|