Chromium Code Reviews| Index: ui/message_center/message_center_impl.cc |
| diff --git a/ui/message_center/message_center_impl.cc b/ui/message_center/message_center_impl.cc |
| index c5e7144ba65c72eb4564eeca7875be722a559b23..949e0d055e9a1e1f9722bcab01c1a31473ea3d1f 100644 |
| --- a/ui/message_center/message_center_impl.cc |
| +++ b/ui/message_center/message_center_impl.cc |
| @@ -82,13 +82,20 @@ void MessageCenterImpl::AddNotification( |
| const string16& message, |
| const string16& display_source, |
| const std::string& extension_id, |
| - const base::DictionaryValue* optional_fields) { |
| + const base::DictionaryValue* optional_fields, |
| + NotificationDelegate* delegate) { |
| // Sometimes the notification can be added with the same id and the |
| // |notification_list| will replace the notification instead of adding new. |
| // This is essentially an update rather than addition. |
| bool already_exists = notification_list_->HasNotification(id); |
| - notification_list_->AddNotification(type, id, title, message, display_source, |
| - extension_id, optional_fields); |
| + notification_list_->AddNotification(type, |
| + id, |
| + title, |
| + message, |
| + display_source, |
| + extension_id, |
| + optional_fields, |
| + delegate); |
| if (already_exists) { |
| FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_, |
| OnNotificationUpdated(id)); |
| @@ -229,8 +236,12 @@ void MessageCenterImpl::ClickOnNotification(const std::string& id) { |
| return; |
| if (HasPopupNotifications()) |
| MarkSinglePopupAsShown(id, true); |
| - FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_, |
| - OnNotificationClicked(id)); |
| + NotificationDelegate* delegate = |
| + notification_list_->GetNotificationDelegate(id); |
| + if (delegate) |
| + delegate->Click(); |
| + FOR_EACH_OBSERVER( |
| + MessageCenterObserver, observer_list_, OnNotificationClicked(id)); |
| } |
| void MessageCenterImpl::ClickOnNotificationButton(const std::string& id, |
| @@ -239,7 +250,12 @@ void MessageCenterImpl::ClickOnNotificationButton(const std::string& id, |
| return; |
| if (HasPopupNotifications()) |
| MarkSinglePopupAsShown(id, true); |
| - FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_, |
| + NotificationDelegate* delegate = |
| + notification_list_->GetNotificationDelegate(id); |
| + if (delegate) |
| + delegate->ButtonClick(button_index); |
| + FOR_EACH_OBSERVER(MessageCenterObserver, |
|
Dmitry Titov
2013/05/24 01:11:57
you use different styles of wrapping long list of
|
| + observer_list_, |
| OnNotificationButtonClicked(id, button_index)); |
| } |
| @@ -258,8 +274,12 @@ void MessageCenterImpl::DisplayedNotification(const std::string& id) { |
| if (HasPopupNotifications()) |
| notification_list_->MarkSinglePopupAsDisplayed(id); |
| - FOR_EACH_OBSERVER(MessageCenterObserver, observer_list_, |
| - OnNotificationDisplayed(id)); |
| + NotificationDelegate* delegate = |
| + notification_list_->GetNotificationDelegate(id); |
| + if (delegate) |
| + delegate->Display(); |
| + FOR_EACH_OBSERVER( |
| + MessageCenterObserver, observer_list_, OnNotificationDisplayed(id)); |
| } |
| void MessageCenterImpl::SetQuietMode(bool in_quiet_mode) { |