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

Unified Diff: ui/message_center/notification_view.cc

Issue 11638035: Set a display limit of 8 on multiple-item notifications items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 12 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
« no previous file with comments | « ui/message_center/message_center_constants.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/notification_view.cc
diff --git a/ui/message_center/notification_view.cc b/ui/message_center/notification_view.cc
index 22d1fc47f6b6feafe182eeedb026568213d086a4..76fc38c08ddefd34ff3c9493a7eded82da9031db 100644
--- a/ui/message_center/notification_view.cc
+++ b/ui/message_center/notification_view.cc
@@ -139,7 +139,9 @@ void NotificationView::SetUpView() {
icon->SetVerticalAlignment(views::ImageView::LEADING);
icon->set_border(MakePadding(kIconTopPadding, kIconLeftPadding,
kIconBottomPadding, kIconToTextPadding));
- layout->AddView(icon, 1, 2 + notification_.items.size());
+ int displayed_item_count =
+ std::min(notification_.items.size(), kNotificationMaxItems);
+ layout->AddView(icon, 1, 2 + displayed_item_count);
// First row: Title. This vertically spans the close button padding row and
// the close button row.
@@ -168,8 +170,9 @@ void NotificationView::SetUpView() {
layout->AddView(close_button_);
// One row for each notification item, including appropriate padding.
- for (int i = 0, n = notification_.items.size(); i < n; ++i) {
- int bottom_padding = (i < n - 1) ? 4 : (kTextBottomPadding - 2);
+ for (int i = 0; i < displayed_item_count; ++i) {
+ int bottom_padding =
+ (i < displayed_item_count - 1) ? 4 : (kTextBottomPadding - 2);
layout->StartRow(0, 0);
layout->SkipColumns(1);
ItemView* item = new ItemView(notification_.items[i]);
« no previous file with comments | « ui/message_center/message_center_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698