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

Unified Diff: ui/message_center/cocoa/notification_controller.mm

Issue 256883002: Update notification style: allow 2-line titles if the message is blank. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix rsesek comments. Created 6 years, 8 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 | « no previous file | ui/message_center/cocoa/notification_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/cocoa/notification_controller.mm
diff --git a/ui/message_center/cocoa/notification_controller.mm b/ui/message_center/cocoa/notification_controller.mm
index 5f642eb9f651247f75d2664bb2f8c7856eaffa84..a6ab485dc25abf5fb718c6758125b080caa7eeed 100644
--- a/ui/message_center/cocoa/notification_controller.mm
+++ b/ui/message_center/cocoa/notification_controller.mm
@@ -343,10 +343,13 @@
message_center::kTextTopPadding - messageBottomGap - contextMessageTopGap;
// Set the title and recalculate the frame.
+ int titleLineLimit = notification_->message().empty()
+ ? message_center::kTitleNoMessageLineLimit
+ : message_center::kTitleLineLimit;
[title_ setString:base::SysUTF16ToNSString(
[self wrapText:notification_->title()
forFont:[title_ font]
- maxNumberOfLines:message_center::kTitleLineLimit])];
+ maxNumberOfLines:titleLineLimit])];
[title_ sizeToFit];
NSRect titleFrame = [title_ frame];
titleFrame.origin.y = NSMaxY(rootFrame) - titlePadding - NSHeight(titleFrame);
@@ -362,7 +365,10 @@
// If there are list items, then the message_ view should not be displayed.
const std::vector<message_center::NotificationItem>& items =
notification->items();
- if (items.size() > 0) {
+ // If there are list items, don't show the main message. Also if the message
+ // is empty, mark it as hidden and set 0 height, so it doesn't take up any
+ // space (size to fit leaves it 15 px tall.
+ if (items.size() > 0 || notification_->message().empty()) {
[message_ setHidden:YES];
messageFrame.origin.y = titleFrame.origin.y;
messageFrame.size.height = 0;
« no previous file with comments | « no previous file | ui/message_center/cocoa/notification_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698