| 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_ui_manager_mac.h" | 5 #include "chrome/browser/notifications/notification_ui_manager_mac.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 [toast setActionButtonTitle:l10n_util::GetNSString( | 140 [toast setActionButtonTitle:l10n_util::GetNSString( |
| 141 IDS_NOTIFICATION_BUTTON_SETTINGS)]; | 141 IDS_NOTIFICATION_BUTTON_SETTINGS)]; |
| 142 } else { | 142 } else { |
| 143 // Otherwise show the alternate menu, then show the developer actions and | 143 // Otherwise show the alternate menu, then show the developer actions and |
| 144 // finally the settings one. | 144 // finally the settings one. |
| 145 DCHECK( | 145 DCHECK( |
| 146 [toast respondsToSelector:@selector(_alwaysShowAlternateActionMenu)]); | 146 [toast respondsToSelector:@selector(_alwaysShowAlternateActionMenu)]); |
| 147 DCHECK( | 147 DCHECK( |
| 148 [toast respondsToSelector:@selector(_alternateActionButtonTitles)]); | 148 [toast respondsToSelector:@selector(_alternateActionButtonTitles)]); |
| 149 | 149 |
| 150 // utf8 ellipsis: | 150 [toast setActionButtonTitle:l10n_util::GetNSString( |
| 151 [toast setActionButtonTitle:@"\u2026"]; | 151 IDS_NOTIFICATION_BUTTON_OPTIONS)]; |
| 152 [toast setValue:@YES | 152 [toast setValue:@YES |
| 153 forKey:@"_alwaysShowAlternateActionMenu"]; | 153 forKey:@"_alwaysShowAlternateActionMenu"]; |
| 154 | 154 |
| 155 NSMutableArray* buttons = [NSMutableArray arrayWithCapacity:3]; | 155 NSMutableArray* buttons = [NSMutableArray arrayWithCapacity:3]; |
| 156 for (const auto& action : notification.buttons()) | 156 for (const auto& action : notification.buttons()) |
| 157 [buttons addObject:base::SysUTF16ToNSString(action.title)]; | 157 [buttons addObject:base::SysUTF16ToNSString(action.title)]; |
| 158 [buttons | 158 [buttons |
| 159 addObject:l10n_util::GetNSString(IDS_NOTIFICATION_BUTTON_SETTINGS)]; | 159 addObject:l10n_util::GetNSString(IDS_NOTIFICATION_BUTTON_SETTINGS)]; |
| 160 | 160 |
| 161 [toast setValue:buttons forKey:@"_alternateActionButtonTitles"]; | 161 [toast setValue:buttons forKey:@"_alternateActionButtonTitles"]; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 persistentNotificationId.longLongValue, buttonIndex); | 360 persistentNotificationId.longLongValue, buttonIndex); |
| 361 } | 361 } |
| 362 | 362 |
| 363 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center | 363 - (BOOL)userNotificationCenter:(NSUserNotificationCenter*)center |
| 364 shouldPresentNotification:(NSUserNotification*)nsNotification { | 364 shouldPresentNotification:(NSUserNotification*)nsNotification { |
| 365 // Always display notifications, regardless of whether the app is foreground. | 365 // Always display notifications, regardless of whether the app is foreground. |
| 366 return YES; | 366 return YES; |
| 367 } | 367 } |
| 368 | 368 |
| 369 @end | 369 @end |
| OLD | NEW |