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..e3153ed148253e51baed9e6a6bb4a002f117d847 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 |
| @@ -464,15 +464,19 @@ public class NotificationPlatformBridge { |
| * @param renotify Whether the sound, vibration, and lights should be replayed if the |
| * notification is replacing another notification. |
| * @param silent Whether the default sound, vibration and lights should be suppressed. |
| + * // TODO awdf: Combine the following four parameters into a single array of Action objects. |
|
Peter Beverloo
2016/09/22 18:07:55
nits:
(1) No need to comment a comment in a comm
awdf
2016/09/23 15:24:56
Done.
(oops - guess I'm just so used to typing "/
|
| * @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 |