Chromium Code Reviews| 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 ade983f15f817b173d31b062c83b7056a4f20009..e7b5461db38bd720bf93b0adfffb7f707c4bd77f 100644 | 
| --- a/ui/message_center/cocoa/notification_controller.mm | 
| +++ b/ui/message_center/cocoa/notification_controller.mm | 
| @@ -200,11 +200,14 @@ | 
| // Creates a box that shows a border when the icon is not big enough to fill the | 
| // space. | 
| -- (NSBox*)createImageBox; | 
| +- (NSBox*)createImageBox:(gfx::Image)notificationImage; | 
| 
 
Robert Sesek
2014/01/29 22:37:48
While it's cheap to copy gfx::Image, you can use a
 
dewittj
2014/01/30 00:41:56
Done.
 
 | 
| // Initializes the closeButton_ ivar with the configured button. | 
| - (void)configureCloseButtonInFrame:(NSRect)rootFrame; | 
| +// Initializes the smallImage_ ivar with the appropriate frame. | 
| +- (void)configureSmallImageInFrame:(NSRect)rootFrame; | 
| + | 
| // Initializes title_ in the given frame. | 
| - (void)configureTitleInFrame:(NSRect)rootFrame; | 
| @@ -229,7 +232,7 @@ | 
| // it is too long. | 
| - (base::string16)wrapText:(const base::string16&)text | 
| forFont:(NSFont*)font | 
| - maxNumberOfLines:(size_t)lines; | 
| + maxNumberOfLines:(size_t)lines; | 
| @end | 
| //////////////////////////////////////////////////////////////////////////////// | 
| @@ -264,6 +267,9 @@ | 
| [self configureCloseButtonInFrame:rootFrame]; | 
| [rootView addSubview:closeButton_]; | 
| + [self configureSmallImageInFrame:rootFrame]; | 
| + [[self view] addSubview:smallImage_]; | 
| + | 
| // Create the title. | 
| [self configureTitleInFrame:rootFrame]; | 
| [rootView addSubview:title_]; | 
| @@ -288,6 +294,8 @@ | 
| message_center::kNotificationPreferredImageWidth, | 
| message_center::kNotificationIconSize); | 
| + [smallImage_ setImage:notification_->small_image().AsNSImage()]; | 
| + | 
| // Update the icon. | 
| [icon_ setImage:notification_->icon().AsNSImage()]; | 
| @@ -643,11 +651,15 @@ | 
| } | 
| - (void)configureCloseButtonInFrame:(NSRect)rootFrame { | 
| - closeButton_.reset([[HoverImageButton alloc] initWithFrame:NSMakeRect( | 
| - NSMaxX(rootFrame) - message_center::kControlButtonSize, | 
| - NSMaxY(rootFrame) - message_center::kControlButtonSize, | 
| - message_center::kControlButtonSize, | 
| - message_center::kControlButtonSize)]); | 
| + // The close button is configured to be the same size as the small image. | 
| + int closeButtonOriginOffset = | 
| + message_center::kSmallImageSize + message_center::kSmallImagePadding; | 
| + NSRect closeButtonFrame = | 
| + NSMakeRect(NSMaxX(rootFrame) - closeButtonOriginOffset, | 
| + NSMaxY(rootFrame) - closeButtonOriginOffset, | 
| + message_center::kSmallImageSize, | 
| + message_center::kSmallImageSize); | 
| + closeButton_.reset([[HoverImageButton alloc] initWithFrame:closeButtonFrame]); | 
| ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 
| [closeButton_ setDefaultImage: | 
| rb.GetNativeImageNamed(IDR_NOTIFICATION_CLOSE).ToNSImage()]; | 
| @@ -670,6 +682,19 @@ | 
| forAttribute:NSAccessibilityTitleAttribute]; | 
| } | 
| +- (void)configureSmallImageInFrame:(NSRect)rootFrame { | 
| + int smallImageXOffset = | 
| + message_center::kSmallImagePadding + message_center::kSmallImageSize; | 
| + NSRect smallImageFrame = | 
| + NSMakeRect(NSMaxX(rootFrame) - smallImageXOffset, | 
| + NSMinY(rootFrame) + message_center::kSmallImagePadding, | 
| + message_center::kSmallImageSize, | 
| + message_center::kSmallImageSize); | 
| + smallImage_.reset([[NSImageView alloc] initWithFrame:smallImageFrame]); | 
| + [smallImage_ setImageScaling:NSImageScaleProportionallyUpOrDown]; | 
| + [smallImage_ setAutoresizingMask:NSViewMinYMargin]; | 
| +} | 
| + | 
| - (void)configureTitleInFrame:(NSRect)rootFrame { | 
| NSRect frame = [self currentContentRect]; | 
| frame.size.height = 0; |