summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpetewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-10 00:41:10 +0000
committerpetewil@chromium.org <petewil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-10 00:41:10 +0000
commitb203d39dc0c292f09e6c359a8b3831bceb0941b6 (patch)
tree90d6c0ae8463b28f658e4e6f09bd8656c398093b
parenta215ef7a21b3fc5b1a53785895b7da126e693548 (diff)
downloadchromium_src-b203d39dc0c292f09e6c359a8b3831bceb0941b6.zip
chromium_src-b203d39dc0c292f09e6c359a8b3831bceb0941b6.tar.gz
chromium_src-b203d39dc0c292f09e6c359a8b3831bceb0941b6.tar.bz2
Synced Notifications Layout Changes
Per latest designs from UX, move to the 3 line format provided by the Notification Center, remove all multi-line notification data, and always use the first profile image photo instead of the app icon for multiple senders. BUG=281520 Review URL: https://chromiumcodereview.appspot.com/23981004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222157 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/notifications/sync_notifier/synced_notification.cc26
-rw-r--r--chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc12
2 files changed, 7 insertions, 31 deletions
diff --git a/chrome/browser/notifications/sync_notifier/synced_notification.cc b/chrome/browser/notifications/sync_notifier/synced_notification.cc
index 00e8df2..c850cac 100644
--- a/chrome/browser/notifications/sync_notifier/synced_notification.cc
+++ b/chrome/browser/notifications/sync_notifier/synced_notification.cc
@@ -114,7 +114,6 @@ void SyncedNotification::OnFetchComplete(const GURL url,
// Count off the bitmaps as they arrive.
--active_fetcher_count_;
- DCHECK_GE(active_fetcher_count_, 0);
// See if all bitmaps are accounted for, if so call Show.
if (active_fetcher_count_ == 0) {
Show(notification_manager_, notifier_service_, profile_);
@@ -219,7 +218,6 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager,
base::Time creation_time =
base::Time::FromDoubleT(static_cast<double>(GetCreationTime()));
int priority = GetPriority();
- int notification_count = GetNotificationCount();
unsigned int button_count = GetButtonCount();
// Deduce which notification template to use from the data.
@@ -227,8 +225,6 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager,
message_center::NOTIFICATION_TYPE_BASE_FORMAT;
if (!image_url.is_empty()) {
notification_type = message_center::NOTIFICATION_TYPE_IMAGE;
- } else if (notification_count > 1) {
- notification_type = message_center::NOTIFICATION_TYPE_MULTIPLE;
} else if (button_count > 0) {
notification_type = message_center::NOTIFICATION_TYPE_BASE_FORMAT;
}
@@ -263,26 +259,14 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager,
if (!image_bitmap_.IsEmpty())
rich_notification_data.image = image_bitmap_;
- // Fill the individual notification fields for a multiple notification.
- if (notification_count > 1) {
- for (int ii = 0; ii < notification_count; ++ii) {
- message_center::NotificationItem item(
- UTF8ToUTF16(GetContainedNotificationTitle(ii)),
- UTF8ToUTF16(GetContainedNotificationMessage(ii)));
- rich_notification_data.items.push_back(item);
- }
- }
-
- // The text encompasses both the description and the annotation.
- if (!notification_text.empty())
- notification_text = notification_text + newline;
- notification_text = notification_text + annotation;
+ // Set the ContextMessage inside the rich notification data for the
+ // annotation.
+ rich_notification_data.context_message = annotation;
- // If there is a single person sending, use their picture instead of the app
- // icon.
+ // If there is at least one person sending, use the first picture.
// TODO(petewil): Someday combine multiple profile photos here.
gfx::Image icon_bitmap = app_icon_bitmap_;
- if (GetProfilePictureCount() == 1) {
+ if (GetProfilePictureCount() >= 1) {
icon_bitmap = sender_bitmap_;
}
diff --git a/chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc b/chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc
index 49d3668..2c4986d 100644
--- a/chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc
+++ b/chrome/browser/notifications/sync_notifier/synced_notification_unittest.cc
@@ -327,20 +327,12 @@ TEST_F(SyncedNotificationTest, ShowTest) {
// Check the base fields of the notification.
EXPECT_EQ(message_center::NOTIFICATION_TYPE_IMAGE, notification.type());
EXPECT_EQ(std::string(kTitle1), UTF16ToUTF8(notification.title()));
- EXPECT_EQ(std::string(kText1And1), UTF16ToUTF8(notification.message()));
+ EXPECT_EQ(std::string(kText1), UTF16ToUTF8(notification.message()));
EXPECT_EQ(std::string(kExpectedOriginUrl), notification.origin_url().spec());
EXPECT_EQ(std::string(kKey1), UTF16ToUTF8(notification.replace_id()));
EXPECT_EQ(kFakeCreationTime, notification.timestamp().ToDoubleT());
EXPECT_EQ(kNotificationPriority, notification.priority());
-
- EXPECT_EQ(UTF8ToUTF16(kContainedTitle1), notification.items()[0].title);
- EXPECT_EQ(UTF8ToUTF16(kContainedTitle2), notification.items()[1].title);
- EXPECT_EQ(UTF8ToUTF16(kContainedTitle3), notification.items()[2].title);
-
- EXPECT_EQ(UTF8ToUTF16(kContainedMessage1), notification.items()[0].message);
- EXPECT_EQ(UTF8ToUTF16(kContainedMessage2), notification.items()[1].message);
- EXPECT_EQ(UTF8ToUTF16(kContainedMessage3), notification.items()[2].message);
}
TEST_F(SyncedNotificationTest, DismissTest) {
@@ -406,7 +398,7 @@ TEST_F(SyncedNotificationTest, OnFetchCompleteTest) {
notification_manager.notification().type());
EXPECT_EQ(std::string(kTitle1),
UTF16ToUTF8(notification_manager.notification().title()));
- EXPECT_EQ(std::string(kText1And1),
+ EXPECT_EQ(std::string(kText1),
UTF16ToUTF8(notification_manager.notification().message()));
// TODO(petewil): Check that the bitmap in the notification is what we expect.