Chromium Code Reviews| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 const Notification& notification) { | 175 const Notification& notification) { |
| 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 [builder setContextMessage:base::SysUTF16ToNSString(notification.message())]; | 185 |
| 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); | |
|
Peter Beverloo
2017/04/13 14:27:29
You could improve RTL support by using a simple st
| |
| 191 | |
| 192 [builder setContextMessage:base::SysUTF16ToNSString(context_message)]; | |
| 186 | 193 |
| 187 bool requires_attribution = | 194 bool requires_attribution = |
| 188 notification.context_message().empty() && | 195 notification.context_message().empty() && |
| 189 notification_type != NotificationCommon::EXTENSION; | 196 notification_type != NotificationCommon::EXTENSION; |
| 190 | 197 |
| 191 base::string16 subtitle = | 198 base::string16 subtitle = |
| 192 requires_attribution | 199 requires_attribution |
| 193 ? url_formatter::FormatOriginForSecurityDisplay( | 200 ? url_formatter::FormatOriginForSecurityDisplay( |
| 194 url::Origin(notification.origin_url()), | 201 url::Origin(notification.origin_url()), |
| 195 url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS) | 202 url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS) |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 base::scoped_nsobject<CrXPCMachPort> xpcPort( | 554 base::scoped_nsobject<CrXPCMachPort> xpcPort( |
| 548 [[CrXPCMachPort alloc] initWithMachSendRight:std::move(exceptionPort)]); | 555 [[CrXPCMachPort alloc] initWithMachSendRight:std::move(exceptionPort)]); |
| 549 [proxy setMachExceptionPort:xpcPort]; | 556 [proxy setMachExceptionPort:xpcPort]; |
| 550 setExceptionPort_ = YES; | 557 setExceptionPort_ = YES; |
| 551 } | 558 } |
| 552 | 559 |
| 553 return proxy; | 560 return proxy; |
| 554 } | 561 } |
| 555 | 562 |
| 556 @end | 563 @end |
| OLD | NEW |