Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1833)

Unified Diff: chrome/browser/notifications/message_center_notification_manager.cc

Issue 14631005: Enable users of NotificationUIManager to specify binary images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix extension_id handling. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/message_center_notification_manager.cc
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc
index d2cc43f32347774ff8952ee70219432f3be48614..c165135d006177f7e56b7b7de1364855a48fdf8d 100644
--- a/chrome/browser/notifications/message_center_notification_manager.cc
+++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -27,8 +27,8 @@
MessageCenterNotificationManager::MessageCenterNotificationManager(
message_center::MessageCenter* message_center)
- : message_center_(message_center),
- settings_controller_(new MessageCenterSettingsController) {
+ : message_center_(message_center),
+ settings_controller_(new MessageCenterSettingsController) {
message_center_->SetDelegate(this);
message_center_->AddObserver(this);
@@ -166,12 +166,15 @@ bool MessageCenterNotificationManager::UpdateNotification(
ProfileNotification* new_notification =
new ProfileNotification(profile, notification, message_center_);
profile_notifications_[notification.notification_id()] = new_notification;
+
+ // Now pass a copy to message center.
+ scoped_ptr<message_center::Notification> message_center_notification(
+ make_scoped_ptr(new message_center::Notification(notification)));
+ message_center_notification->set_extension_id(
+ new_notification->GetExtensionId());
message_center_->UpdateNotification(old_id,
- notification.notification_id(),
- notification.title(),
- notification.body(),
- notification.optional_fields(),
- notification.delegate());
+ message_center_notification.Pass());
+
new_notification->StartDownloads();
return true;
}
@@ -455,14 +458,13 @@ void MessageCenterNotificationManager::AddProfileNotification(
DCHECK(profile_notifications_.find(id) == profile_notifications_.end());
profile_notifications_[id] = profile_notification;
- message_center_->AddNotification(notification.type(),
- notification.notification_id(),
- notification.title(),
- notification.body(),
- notification.display_source(),
- profile_notification->GetExtensionId(),
- notification.optional_fields(),
- notification.delegate());
+ // Create the copy for message center, and ensure the extension ID is correct.
+ scoped_ptr<message_center::Notification> message_center_notification(
+ new message_center::Notification(notification));
+ message_center_notification->set_extension_id(
+ profile_notification->GetExtensionId());
+ message_center_->AddNotification(message_center_notification.Pass());
+
profile_notification->StartDownloads();
}

Powered by Google App Engine
This is Rietveld 408576698