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:
parent
026e7bff40
commit
8e125b2953
6 changed files with 37 additions and 14 deletions
|
@ -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(),
|
||||
[¬ification_id](const Notification* n) {
|
||||
return n->notification_id() == notification_id;
|
||||
});
|
||||
if (it != notifications_.end())
|
||||
(*it)->Dismiss();
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue