| 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 1b4e96a0ce1ecb1a05f0b1e43271e350a26a667d..06e1210c4311178779725c4cfcebf55f8c2ceca0 100644
|
| --- a/ui/message_center/cocoa/notification_controller.mm
|
| +++ b/ui/message_center/cocoa/notification_controller.mm
|
| @@ -10,6 +10,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "components/url_formatter/elide_url.h"
|
| #include "skia/ext/skia_utils_mac.h"
|
| #import "ui/base/cocoa/hover_image_button.h"
|
| #include "ui/base/l10n/l10n_util_mac.h"
|
| @@ -22,7 +23,7 @@
|
| #include "ui/message_center/notification.h"
|
| #include "ui/resources/grit/ui_resources.h"
|
| #include "ui/strings/grit/ui_strings.h"
|
| -
|
| +#include "url/gurl.h"
|
|
|
| @interface MCNotificationProgressBar : NSProgressIndicator
|
| @end
|
| @@ -380,11 +381,11 @@
|
|
|
| // Set the title and recalculate the frame.
|
| size_t actualTitleLines = 0;
|
| - [title_ setString:base::SysUTF16ToNSString(
|
| - [self wrapText:notification_->title()
|
| - forFont:[title_ font]
|
| - maxNumberOfLines:message_center::kMaxTitleLines
|
| - actualLines:&actualTitleLines])];
|
| + [title_ setString:base::SysUTF16ToNSString([self
|
| + wrapText:notification_->title()
|
| + forFont:[title_ font]
|
| + maxNumberOfLines:message_center::kMaxTitleLines
|
| + actualLines:&actualTitleLines])];
|
| [title_ sizeToFit];
|
| NSRect titleFrame = [title_ frame];
|
| titleFrame.origin.y = NSMaxY(rootFrame) - titlePadding - NSHeight(titleFrame);
|
| @@ -396,7 +397,8 @@
|
| messageLineLimit -= (actualTitleLines - 1) * 2;
|
| if (!notification_->image().IsEmpty()) {
|
| messageLineLimit /= 2;
|
| - if (!notification_->context_message().empty())
|
| +
|
| + if (!notification_->context_message().message.empty())
|
| messageLineLimit -= message_center::kContextMessageLineLimit;
|
| }
|
| if (messageLineLimit < 0)
|
| @@ -428,14 +430,26 @@
|
| }
|
|
|
| // Set the context message and recalculate the frame.
|
| - [contextMessage_ setString:base::SysUTF16ToNSString(
|
| - [self wrapText:notification_->context_message()
|
| - forFont:[contextMessage_ font]
|
| - maxNumberOfLines:message_center::kContextMessageLineLimit])];
|
| + base::string16 message;
|
| + if (notification->context_message().is_origin) {
|
| + GURL url(notification_->context_message().message);
|
| + gfx::FontList font_list((gfx::Font([message_ font])));
|
| + message = url_formatter::ElideHost(
|
| + url, font_list, message_center::kContextMessageViewWidth);
|
| + } else {
|
| + message = base::UTF8ToUTF16(notification_->context_message().message);
|
| + }
|
| +
|
| + [contextMessage_
|
| + setString:
|
| + base::SysUTF16ToNSString([self
|
| + wrapText:message
|
| + forFont:[contextMessage_ font]
|
| + maxNumberOfLines:message_center::kContextMessageLineLimit])];
|
| [contextMessage_ sizeToFit];
|
| NSRect contextMessageFrame = [contextMessage_ frame];
|
|
|
| - if (notification_->context_message().empty()) {
|
| + if (notification_->context_message().message.empty()) {
|
| [contextMessage_ setHidden:YES];
|
| contextMessageFrame.origin.y = messageFrame.origin.y;
|
| contextMessageFrame.size.height = 0;
|
|
|