REVIEW: Remove the notification close-closure in favour of an explicit method

https://chromium-review.googlesource.com/c/chromium/src/+/744205
This commit is contained in:
deepak1556 2018-04-09 00:54:08 +05:30 committed by Samuel Attard
parent 026e7bff40
commit 8e125b2953
6 changed files with 37 additions and 14 deletions

View file

@ -16,8 +16,10 @@ NotificationPresenter::~NotificationPresenter() {
}
base::WeakPtr<Notification> NotificationPresenter::CreateNotification(
NotificationDelegate* delegate) {
NotificationDelegate* delegate,
const std::string& notification_id) {
Notification* notification = CreateNotificationObject(delegate);
notification->set_notification_id(notification_id);
notifications_.insert(notification);
return notification->GetWeakPtr();
}
@ -27,4 +29,14 @@ void NotificationPresenter::RemoveNotification(Notification* notification) {
delete notification;
}
void NotificationPresenter::CloseNotificationWithId(
const std::string& notification_id) {
auto it = std::find_if(notifications_.begin(), notifications_.end(),
[&notification_id](const Notification* n) {
return n->notification_id() == notification_id;
});
if (it != notifications_.end())
(*it)->Dismiss();
}
} // namespace brightray