| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/notifications/notification_platform_bridge_mac.h" | 5 #include "chrome/browser/notifications/notification_platform_bridge_mac.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 base::scoped_nsobject<NotificationBuilder> builder( | 176 base::scoped_nsobject<NotificationBuilder> builder( |
| 177 [[NotificationBuilder alloc] | 177 [[NotificationBuilder alloc] |
| 178 initWithCloseLabel:l10n_util::GetNSString(IDS_NOTIFICATION_BUTTON_CLOSE) | 178 initWithCloseLabel:l10n_util::GetNSString(IDS_NOTIFICATION_BUTTON_CLOSE) |
| 179 optionsLabel:l10n_util::GetNSString(IDS_NOTIFICATION_BUTTON_MORE) | 179 optionsLabel:l10n_util::GetNSString(IDS_NOTIFICATION_BUTTON_MORE) |
| 180 settingsLabel:l10n_util::GetNSString( | 180 settingsLabel:l10n_util::GetNSString( |
| 181 IDS_NOTIFICATION_BUTTON_SETTINGS)]); | 181 IDS_NOTIFICATION_BUTTON_SETTINGS)]); |
| 182 | 182 |
| 183 [builder | 183 [builder |
| 184 setTitle:base::SysUTF16ToNSString(CreateNotificationTitle(notification))]; | 184 setTitle:base::SysUTF16ToNSString(CreateNotificationTitle(notification))]; |
| 185 | 185 |
| 186 [builder setContextMessage:base::SysUTF16ToNSString(notification.message())]; | 186 base::string16 context_message = |
| 187 notification.items().empty() |
| 188 ? notification.message() |
| 189 : (notification.items().at(0).title + base::UTF8ToUTF16(" - ") + |
| 190 notification.items().at(0).message); |
| 191 |
| 192 [builder setContextMessage:base::SysUTF16ToNSString(context_message)]; |
| 187 | 193 |
| 188 bool requires_attribution = | 194 bool requires_attribution = |
| 189 notification.context_message().empty() && | 195 notification.context_message().empty() && |
| 190 notification_type != NotificationCommon::EXTENSION; | 196 notification_type != NotificationCommon::EXTENSION; |
| 191 | 197 |
| 192 base::string16 subtitle = | 198 base::string16 subtitle = |
| 193 requires_attribution | 199 requires_attribution |
| 194 ? url_formatter::FormatOriginForSecurityDisplay( | 200 ? url_formatter::FormatOriginForSecurityDisplay( |
| 195 url::Origin(notification.origin_url()), | 201 url::Origin(notification.origin_url()), |
| 196 url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS) | 202 url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS) |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 base::scoped_nsobject<CrXPCMachPort> xpcPort( | 555 base::scoped_nsobject<CrXPCMachPort> xpcPort( |
| 550 [[CrXPCMachPort alloc] initWithMachSendRight:std::move(exceptionPort)]); | 556 [[CrXPCMachPort alloc] initWithMachSendRight:std::move(exceptionPort)]); |
| 551 [proxy setMachExceptionPort:xpcPort]; | 557 [proxy setMachExceptionPort:xpcPort]; |
| 552 setExceptionPort_ = YES; | 558 setExceptionPort_ = YES; |
| 553 } | 559 } |
| 554 | 560 |
| 555 return proxy; | 561 return proxy; |
| 556 } | 562 } |
| 557 | 563 |
| 558 @end | 564 @end |
| OLD | NEW |