Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java |
index d75b12692d48fd0fcce753315dc13cdc20af94f8..010fd3da1804698bf2bb781b0b7db08eda93a947 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java |
@@ -420,12 +420,17 @@ static int makeDefaults(int vibrationPatternLength, boolean silent) { |
* @param vibrationPattern Vibration pattern following the Web Vibration syntax. |
* @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. |
* @see https://developer.android.com/reference/android/app/Notification.html |
*/ |
@CalledByNative |
private void displayNotification(long persistentNotificationId, String origin, String profileId, |
boolean incognito, String tag, String title, String body, Bitmap icon, |
- int[] vibrationPattern, boolean silent, String[] actionTitles) { |
+ int[] vibrationPattern, boolean silent, String[] actionTitles, Bitmap[] actionIcons) { |
+ if (actionTitles.length != actionIcons.length) { |
+ throw new IllegalStateException("The number of action titles and icons must match."); |
+ } |
+ |
Resources res = mAppContext.getResources(); |
// Record whether it's known whether notifications can be shown to the user at all. |
@@ -464,11 +469,16 @@ private void displayNotification(long persistentNotificationId, String origin, S |
.setOrigin(UrlUtilities.formatUrlForSecurityDisplay( |
origin, false /* showScheme */)); |
- for (int actionIndex = 0; actionIndex < actionTitles.length; actionIndex++) { |
- notificationBuilder.addAction(0 /* actionIcon */, actionTitles[actionIndex], |
- makePendingIntent(NotificationConstants.ACTION_CLICK_NOTIFICATION, |
- persistentNotificationId, origin, profileId, |
- incognito, tag, actionIndex)); |
+ // TODO: handle bitmaps for standard notifications as well. |
+ if (useCustomLayouts()) { |
+ CustomNotificationBuilder customBuilder = |
+ (CustomNotificationBuilder) notificationBuilder; |
+ for (int actionIndex = 0; actionIndex < actionTitles.length; actionIndex++) { |
+ customBuilder.addAction(actionIcons[actionIndex], actionTitles[actionIndex], |
+ makePendingIntent(NotificationConstants.ACTION_CLICK_NOTIFICATION, |
+ persistentNotificationId, origin, profileId, |
+ incognito, tag, actionIndex)); |
+ } |
} |
// If action buttons are displayed, there isn't room for the full Site Settings button |