Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java |
| index afc5c96e5e4a5d5d5bdb02ef06cd13c2a17dcebd..459f6f5e75f0f37b3ec2d86033a505b0cf8fe5f2 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java |
| @@ -441,6 +441,7 @@ public class NotificationPlatformBridge { |
| /** |
| * Displays a notification with the given details. |
| * |
| + * TODO awdf: Combine the four 'action*' parameters into a single array of Action objects. |
|
Peter Beverloo
2016/09/26 16:04:34
micro nit: we generally format our TODOs as:
TODO
awdf
2016/09/27 14:45:27
Done.
|
| * @param notificationId The id of the notification. |
| * @param origin Full text of the origin, including the protocol, owning this notification. |
| * @param profileId Id of the profile that showed the notification. |
| @@ -466,13 +467,16 @@ public class NotificationPlatformBridge { |
| * @param silent Whether the default sound, vibration and lights should be suppressed. |
| * @param actionTitles Titles of actions to display alongside the notification. |
| * @param actionIcons Icons of actions to display alongside the notification. |
| + * @param actionTypes Types of actions to display alongside the notification. |
| + * @param actionPlaceholders Placeholders of actions to display alongside the notification. |
| * @see https://developer.android.com/reference/android/app/Notification.html |
| */ |
| @CalledByNative |
| private void displayNotification(String notificationId, String origin, String profileId, |
| boolean incognito, String tag, String webApkPackage, String title, String body, |
| Bitmap image, Bitmap icon, Bitmap badge, int[] vibrationPattern, long timestamp, |
| - boolean renotify, boolean silent, String[] actionTitles, Bitmap[] actionIcons) { |
| + boolean renotify, boolean silent, String[] actionTitles, Bitmap[] actionIcons, |
| + String[] actionTypes, String[] actionPlaceholders) { |
| if (actionTitles.length != actionIcons.length) { |
| throw new IllegalArgumentException("The number of action titles and icons must match."); |
| } |
| @@ -519,10 +523,16 @@ public class NotificationPlatformBridge { |
| origin, false /* showScheme */)); |
| for (int actionIndex = 0; actionIndex < actionTitles.length; actionIndex++) { |
| - notificationBuilder.addAction(actionIcons[actionIndex], actionTitles[actionIndex], |
| - makePendingIntent(NotificationConstants.ACTION_CLICK_NOTIFICATION, |
| - notificationId, origin, profileId, incognito, tag, |
| - webApkPackage, actionIndex)); |
| + PendingIntent intent = makePendingIntent( |
| + NotificationConstants.ACTION_CLICK_NOTIFICATION, notificationId, origin, |
| + profileId, incognito, tag, webApkPackage, actionIndex); |
| + if (actionTypes[actionIndex].equals("text")) { |
| + notificationBuilder.addTextAction(actionIcons[actionIndex], |
| + actionTitles[actionIndex], intent, actionPlaceholders[actionIndex]); |
| + } else { |
| + notificationBuilder.addButtonAction( |
| + actionIcons[actionIndex], actionTitles[actionIndex], intent); |
| + } |
| } |
| // If action buttons are displayed, there isn't room for the full Site Settings button |