Chromium Code Reviews| Index: ui/message_center/views/message_popup_collection.cc |
| diff --git a/ui/message_center/views/message_popup_collection.cc b/ui/message_center/views/message_popup_collection.cc |
| index 1a28ffe591e6e9f7e29b0d9876aa3ac6fcd40cb5..91e3c686b0bb450633b2e578adb707cddd889234 100644 |
| --- a/ui/message_center/views/message_popup_collection.cc |
| +++ b/ui/message_center/views/message_popup_collection.cc |
| @@ -83,7 +83,25 @@ void MessagePopupCollection::ClickOnNotification( |
| void MessagePopupCollection::RemoveNotification( |
| const std::string& notification_id, |
| bool by_user) { |
| - message_center_->RemoveNotification(notification_id, by_user); |
| + NotificationList::PopupNotifications notifications = |
| + message_center_->GetPopupNotifications(); |
| + for (NotificationList::PopupNotifications::iterator iter = |
| + notifications.begin(); |
| + iter != notifications.end(); ++iter) { |
| + Notification* notification = *iter; |
| + DCHECK(notification); |
| + |
| + if (notification->id() != notification_id) |
| + continue; |
| + |
| + // Don't remove the notification only when it's not closable. |
|
dewittj
2016/02/10 00:03:15
nit: when it's pinned.
yoshiki
2016/02/12 23:11:36
Done.
|
| + if (!notification->pinned()) |
| + message_center_->RemoveNotification(notification_id, by_user); |
| + else |
| + message_center_->MarkSinglePopupAsShown(notification_id, true /* read */); |
| + |
| + break; |
| + } |
| } |
| scoped_ptr<ui::MenuModel> MessagePopupCollection::CreateMenuModel( |
| @@ -139,10 +157,13 @@ void MessagePopupCollection::UpdateWidgets() { |
| if (FindToast((*iter)->id())) |
| continue; |
| + Notification notification = *(*iter); |
|
dewittj
2016/02/10 00:03:15
I don't love copying the notification in order to
yoshiki
2016/02/12 23:11:36
Done.
|
| + // Override pinned status, since toasts should be closable even when it's |
| + // pinned. |
| + notification.set_pinned(false); |
| NotificationView* view = |
| - NotificationView::Create(NULL, |
| - *(*iter), |
| - true); // Create top-level notification. |
| + NotificationView::Create(NULL, notification, |
| + true); // Create top-level notification. |
| view->set_context_menu_controller(context_menu_controller_.get()); |
| int view_height = ToastContentsView::GetToastSizeForView(view).height(); |
| int height_available = |