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

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

Issue 9241001: clang: Force colors on when building with ninja. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 7 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/cocoa/notification_controller.h ('k') | no next file » | 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 fb99ce970d44b055a638612b108958d51b0419a7..51f8b2cb781875ba469dbf4a0973c537b9d94d7d 100644
--- a/ui/message_center/cocoa/notification_controller.mm
+++ b/ui/message_center/cocoa/notification_controller.mm
@@ -5,6 +5,7 @@
#import "ui/message_center/cocoa/notification_controller.h"
#include "base/mac/foundation_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/strings/sys_string_conversions.h"
#include "grit/ui_resources.h"
#include "skia/ext/skia_utils_mac.h"
@@ -192,6 +193,73 @@
NSMinY(titleFrame) - messagePadding - NSHeight(messageFrame);
messageFrame.size.height = NSHeight([message_ frame]);
+ // Create the list item views (up to a maximum).
+ [listItemView_ removeFromSuperview];
+ std::vector<message_center::NotificationItem> items = notification->items();
+
+ if (items.size() > 0) {
+ NSRect frame = [self currentContentRect];
+ frame.origin.y = 0;
+ frame.size.height = 0;
+ listItemView_.reset([[NSView alloc] initWithFrame:frame]);
+ CGFloat y = 0;
+ //int padding = kMessageLineHeight - views::Label().font().GetHeight();
+ for (int i =
+ std::min(message_center::kNotificationMaximumItems, items.size()) - 1;
+ i >= 0; --i) {
+ NSString* text = base::SysUTF16ToNSString(
+ items[i].title + base::UTF8ToUTF16(" ") + items[i].message);
+
+ CGFloat fontSize = [NSFont systemFontSize];
+ NSFont* boldFont = [NSFont boldSystemFontOfSize:fontSize];
+ NSDictionary* titleAttribs = @{
+ NSFontAttributeName : boldFont,
+ NSForegroundColorAttributeName :
+ gfx::SkColorToDeviceNSColor(message_center::kRegularTextColor),
+ };
+
+ NSFont* regularFont = [NSFont systemFontOfSize:fontSize];
+ NSDictionary* messageAttribs = @{
+ NSFontAttributeName : regularFont,
+ NSForegroundColorAttributeName :
+ gfx::SkColorToDeviceNSColor(message_center::kDimTextColor),
+ };
+
+ NSMutableAttributedString* boldText =
+ [[NSMutableAttributedString alloc] initWithString:text];
+
+ const NSRange titleRange = NSMakeRange(0, items[i].title.size());
+ [boldText setAttributes:titleAttribs range:titleRange];
+
+ const NSRange messageRange =
+ NSMakeRange(items[i].title.size() + 1, items[i].message.size());
+ [boldText setAttributes:messageAttribs range:messageRange];
+
+ NSTextField* field = [self newLabelWithFrame:NSMakeRect(10, i * 20, 200, 20)];
+ [field setAttributedStringValue:[boldText autorelease]];
+
+ [listItemView_ addSubview:field];
+ y += 20;
+
+ //[GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:message_];
+ //NSRect messageFrame = [message_ frame];
+ //messageFrame.origin.y =
+ //NSMinY(titleFrame) - messagePadding - NSHeight(messageFrame);
+ //messageFrame.size.height = NSHeight([message_ frame]);
+ //ItemView* item_view = new ItemView(items[i]);
+ //item_view->SetVisible(is_expanded());
+ //item_view->set_border(MakeTextBorder(padding, i ? 0 : 4, 0));
+ //item_views_.push_back(item_view);
+ //top_view_->AddChildView(item_view);
+ //accessible_lines.push_back(
+ // items[i].title + base::ASCIIToUTF16(" ") + items[i].message);
+ }
+ frame.size.height = y;
+ [listItemView_ setFrame:frame];
+ [[self view] addSubview:listItemView_];
+ }
+
+ // FIXME: this is now wrong
// In this basic notification UI, the message body is the bottom-most
// vertical element. If it is out of the rootView's bounds, resize the view.
if (NSMinY(messageFrame) < messagePadding) {
« no previous file with comments | « ui/message_center/cocoa/notification_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698