Commit b203d39d authored by petewil@chromium.org's avatar petewil@chromium.org

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
parent a215ef7a
...@@ -114,7 +114,6 @@ void SyncedNotification::OnFetchComplete(const GURL url, ...@@ -114,7 +114,6 @@ void SyncedNotification::OnFetchComplete(const GURL url,
// Count off the bitmaps as they arrive. // Count off the bitmaps as they arrive.
--active_fetcher_count_; --active_fetcher_count_;
DCHECK_GE(active_fetcher_count_, 0);
// See if all bitmaps are accounted for, if so call Show. // See if all bitmaps are accounted for, if so call Show.
if (active_fetcher_count_ == 0) { if (active_fetcher_count_ == 0) {
Show(notification_manager_, notifier_service_, profile_); Show(notification_manager_, notifier_service_, profile_);
...@@ -219,7 +218,6 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager, ...@@ -219,7 +218,6 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager,
base::Time creation_time = base::Time creation_time =
base::Time::FromDoubleT(static_cast<double>(GetCreationTime())); base::Time::FromDoubleT(static_cast<double>(GetCreationTime()));
int priority = GetPriority(); int priority = GetPriority();
int notification_count = GetNotificationCount();
unsigned int button_count = GetButtonCount(); unsigned int button_count = GetButtonCount();
// Deduce which notification template to use from the data. // Deduce which notification template to use from the data.
...@@ -227,8 +225,6 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager, ...@@ -227,8 +225,6 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager,
message_center::NOTIFICATION_TYPE_BASE_FORMAT; message_center::NOTIFICATION_TYPE_BASE_FORMAT;
if (!image_url.is_empty()) { if (!image_url.is_empty()) {
notification_type = message_center::NOTIFICATION_TYPE_IMAGE; notification_type = message_center::NOTIFICATION_TYPE_IMAGE;
} else if (notification_count > 1) {
notification_type = message_center::NOTIFICATION_TYPE_MULTIPLE;
} else if (button_count > 0) { } else if (button_count > 0) {
notification_type = message_center::NOTIFICATION_TYPE_BASE_FORMAT; notification_type = message_center::NOTIFICATION_TYPE_BASE_FORMAT;
} }
...@@ -263,26 +259,14 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager, ...@@ -263,26 +259,14 @@ void SyncedNotification::Show(NotificationUIManager* notification_manager,
if (!image_bitmap_.IsEmpty()) if (!image_bitmap_.IsEmpty())
rich_notification_data.image = image_bitmap_; rich_notification_data.image = image_bitmap_;
// Fill the individual notification fields for a multiple notification. // Set the ContextMessage inside the rich notification data for the
if (notification_count > 1) { // annotation.
for (int ii = 0; ii < notification_count; ++ii) { rich_notification_data.context_message = annotation;
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;
// If there is a single person sending, use their picture instead of the app // If there is at least one person sending, use the first picture.
// icon.
// TODO(petewil): Someday combine multiple profile photos here. // TODO(petewil): Someday combine multiple profile photos here.
gfx::Image icon_bitmap = app_icon_bitmap_; gfx::Image icon_bitmap = app_icon_bitmap_;
if (GetProfilePictureCount() == 1) { if (GetProfilePictureCount() >= 1) {
icon_bitmap = sender_bitmap_; icon_bitmap = sender_bitmap_;
} }
......
...@@ -327,20 +327,12 @@ TEST_F(SyncedNotificationTest, ShowTest) { ...@@ -327,20 +327,12 @@ TEST_F(SyncedNotificationTest, ShowTest) {
// Check the base fields of the notification. // Check the base fields of the notification.
EXPECT_EQ(message_center::NOTIFICATION_TYPE_IMAGE, notification.type()); EXPECT_EQ(message_center::NOTIFICATION_TYPE_IMAGE, notification.type());
EXPECT_EQ(std::string(kTitle1), UTF16ToUTF8(notification.title())); 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(kExpectedOriginUrl), notification.origin_url().spec());
EXPECT_EQ(std::string(kKey1), UTF16ToUTF8(notification.replace_id())); EXPECT_EQ(std::string(kKey1), UTF16ToUTF8(notification.replace_id()));
EXPECT_EQ(kFakeCreationTime, notification.timestamp().ToDoubleT()); EXPECT_EQ(kFakeCreationTime, notification.timestamp().ToDoubleT());
EXPECT_EQ(kNotificationPriority, notification.priority()); 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) { TEST_F(SyncedNotificationTest, DismissTest) {
...@@ -406,7 +398,7 @@ TEST_F(SyncedNotificationTest, OnFetchCompleteTest) { ...@@ -406,7 +398,7 @@ TEST_F(SyncedNotificationTest, OnFetchCompleteTest) {
notification_manager.notification().type()); notification_manager.notification().type());
EXPECT_EQ(std::string(kTitle1), EXPECT_EQ(std::string(kTitle1),
UTF16ToUTF8(notification_manager.notification().title())); UTF16ToUTF8(notification_manager.notification().title()));
EXPECT_EQ(std::string(kText1And1), EXPECT_EQ(std::string(kText1),
UTF16ToUTF8(notification_manager.notification().message())); UTF16ToUTF8(notification_manager.notification().message()));
// TODO(petewil): Check that the bitmap in the notification is what we expect. // TODO(petewil): Check that the bitmap in the notification is what we expect.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment