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

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: Adds a test. 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..ead8fc7f552a022f780ad1b3e8b602f2d778aa7f 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.
- [title_ setString:base::SysUTF16ToNSString(
- [self wrapText:notification_->title()
- forFont:[title_ font]
- maxNumberOfLines:message_center::kTitleLineLimit])];
+ int titleLineLimit = notification_->message().empty()
+ ? message_center::kTitleNoMessageLineLimit
+ : message_center::kTitleLineLimit;
+ [title_
+ setString:base::SysUTF16ToNSString([self wrapText:notification_->title()
Robert Sesek 2014/04/28 20:49:28 You probably clang-formatted this, but it looks wr
dewittj 2014/04/28 21:05:32 Done. This is not actually churn just for the sak
Robert Sesek 2014/04/28 21:07:29 Yeah, I think the ObjC formatter is less-tested/us
+ forFont:[title_ font]
+ 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 hight, so it doesn't take up any
Robert Sesek 2014/04/28 20:49:28 nit: height
dewittj 2014/04/28 21:05:32 Done.
+ // 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