From 0fa85dd72dad4416aa8dd2c9d06cea7e413031cd Mon Sep 17 00:00:00 2001 From: "dewittj@chromium.org" Date: Thu, 6 Jun 2013 04:48:57 +0000 Subject: Enable users of NotificationUIManager to specify binary images. This refactors message_center::Notification to hold a class containing the optional data associated with the notification. It also alters chrome/browser/notification so that you can manually set this. Ash tests only updated to use new API. TBR=sky@chromium.org,stevenjb@chromium.org BUG=227093 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=204181 Review URL: https://chromiumcodereview.appspot.com/14631005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204419 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/shell/window_type_launcher.cc | 21 +++++++++++++-------- .../web_notification_tray_unittest.cc | 20 ++++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) (limited to 'ash') diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc index bf7d059..3080f91 100644 --- a/ash/shell/window_type_launcher.cc +++ b/ash/shell/window_type_launcher.cc @@ -347,16 +347,21 @@ void WindowTypeLauncher::ButtonPressed(views::Button* sender, base::TimeDelta::FromSeconds(5)); } else if (sender == show_web_notification_) { + scoped_ptr notification; + notification.reset(new message_center::Notification( + message_center::NOTIFICATION_TYPE_SIMPLE, + "id0", + ASCIIToUTF16("Test Shell Web Notification"), + ASCIIToUTF16("Notification message body."), + gfx::Image(), + ASCIIToUTF16("www.testshell.org"), + "" /* extension id */, + NULL /* optional_fields */, + NULL /* delegate */)); + ash::Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget() ->web_notification_tray()->message_center() - ->AddNotification(message_center::NOTIFICATION_TYPE_SIMPLE, - "id0", - ASCIIToUTF16("Test Shell Web Notification"), - ASCIIToUTF16("Notification message body."), - ASCIIToUTF16("www.testshell.org"), - "" /* extension id */, - NULL /* optional_fields */, - NULL /* delegate */); + ->AddNotification(notification.Pass()); } #if !defined(OS_MACOSX) else if (sender == examples_button_) { diff --git a/ash/system/web_notification/web_notification_tray_unittest.cc b/ash/system/web_notification/web_notification_tray_unittest.cc index e144fe9..5b59312 100644 --- a/ash/system/web_notification/web_notification_tray_unittest.cc +++ b/ash/system/web_notification/web_notification_tray_unittest.cc @@ -56,26 +56,34 @@ class WebNotificationTrayTest : public test::AshTestBase { protected: void AddNotification(const std::string& id) { - GetMessageCenter()->AddNotification( + scoped_ptr notification; + notification.reset(new message_center::Notification( message_center::NOTIFICATION_TYPE_SIMPLE, id, ASCIIToUTF16("Test Web Notification"), ASCIIToUTF16("Notification message body."), + gfx::Image(), ASCIIToUTF16("www.test.org"), "" /* extension id */, NULL /* optional_fields */, - NULL /* delegate */); + NULL /* delegate */)); + GetMessageCenter()->AddNotification(notification.Pass()); } void UpdateNotification(const std::string& old_id, const std::string& new_id) { - GetMessageCenter()->UpdateNotification( - old_id, + scoped_ptr notification; + notification.reset(new message_center::Notification( + message_center::NOTIFICATION_TYPE_SIMPLE, new_id, ASCIIToUTF16("Updated Web Notification"), ASCIIToUTF16("Updated message body."), - NULL, - NULL); + gfx::Image(), + ASCIIToUTF16("www.test.org"), + "" /* extension id */, + NULL /* optional_fields */, + NULL /* delegate */)); + GetMessageCenter()->UpdateNotification(old_id, notification.Pass()); } void RemoveNotification(const std::string& id) { -- cgit v1.1