Index: ui/message_center/notification_list.cc |
diff --git a/ui/message_center/notification_list.cc b/ui/message_center/notification_list.cc |
index 8770ee793c7f3ac594ac24a6651c7cbfb9a6549d..4191f7c580c4435cba3df0792f10a96e2d586360 100644 |
--- a/ui/message_center/notification_list.cc |
+++ b/ui/message_center/notification_list.cc |
@@ -71,63 +71,33 @@ void NotificationList::SetMessageCenterVisible( |
} |
} |
-void NotificationList::AddNotification(NotificationType type, |
- const std::string& id, |
- const string16& title, |
- const string16& message, |
- const string16& display_source, |
- const std::string& extension_id, |
- const DictionaryValue* optional_fields, |
- NotificationDelegate* delegate) { |
- scoped_ptr<Notification> notification(new Notification(type, |
- id, |
- title, |
- message, |
- display_source, |
- extension_id, |
- optional_fields, |
- delegate)); |
+void NotificationList::AddNotification(scoped_ptr<Notification> notification) { |
PushNotification(notification.Pass()); |
} |
void NotificationList::UpdateNotificationMessage( |
const std::string& old_id, |
- const std::string& new_id, |
- const string16& title, |
- const string16& message, |
- const base::DictionaryValue* optional_fields, |
- NotificationDelegate* delegate) { |
+ scoped_ptr<Notification> new_notification) { |
Notifications::iterator iter = GetNotification(old_id); |
if (iter == notifications_.end()) |
return; |
- // Copy and update a notification. It has an effect of setting a new timestamp |
- // if not overridden by optional_fields |
- scoped_ptr<Notification> notification( |
- new Notification((*iter)->type(), |
- new_id, |
- title, |
- message, |
- (*iter)->display_source(), |
- (*iter)->extension_id(), |
- optional_fields, |
- delegate)); |
- notification->CopyState(*iter); |
+ new_notification->CopyState(*iter); |
// Handles priority promotion. If the notification is already dismissed but |
// the updated notification has higher priority, it should re-appear as a |
// toast. |
- if ((*iter)->priority() < notification->priority()) { |
- notification->set_is_read(false); |
- notification->set_shown_as_popup(false); |
+ if ((*iter)->priority() < new_notification->priority()) { |
+ new_notification->set_is_read(false); |
+ new_notification->set_shown_as_popup(false); |
} |
// Do not use EraseNotification and PushNotification, since we don't want to |
// change unread counts nor to update is_read/shown_as_popup states. |
- Notification *old = *iter; |
+ Notification* old = *iter; |
notifications_.erase(iter); |
delete old; |
- notifications_.insert(notification.release()); |
+ notifications_.insert(new_notification.release()); |
} |
void NotificationList::RemoveNotification(const std::string& id) { |
@@ -199,7 +169,8 @@ bool NotificationList::SetNotificationButtonIcon( |
Notifications::iterator iter = GetNotification(notification_id); |
if (iter == notifications_.end()) |
return false; |
- return (*iter)->SetButtonIcon(button_index, image); |
+ (*iter)->SetButtonIcon(button_index, image); |
+ return true; |
} |
bool NotificationList::HasNotification(const std::string& id) { |