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 daa6663ef5ddc4b19109a3f4733fa2df18c92d09..b16ffebcbafc9655bea78bda87f96c209b8a82a2 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 |
@@ -423,12 +423,18 @@ static int makeDefaults(int vibrationPatternLength, boolean silent) { |
* @param timestamp The timestamp of the event for which the notification is being shown. |
* @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, long timestamp, boolean silent, String[] actionTitles) { |
+ int[] vibrationPattern, long timestamp, boolean silent, String[] actionTitles, |
+ Bitmap[] actionIcons) { |
+ if (actionTitles.length != actionIcons.length) { |
+ throw new IllegalArgumentException("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. |
@@ -469,7 +475,7 @@ private void displayNotification(long persistentNotificationId, String origin, S |
origin, false /* showScheme */)); |
for (int actionIndex = 0; actionIndex < actionTitles.length; actionIndex++) { |
- notificationBuilder.addAction(0 /* actionIcon */, actionTitles[actionIndex], |
+ notificationBuilder.addAction(actionIcons[actionIndex], actionTitles[actionIndex], |
makePendingIntent(NotificationConstants.ACTION_CLICK_NOTIFICATION, |
persistentNotificationId, origin, profileId, |
incognito, tag, actionIndex)); |
@@ -584,12 +590,12 @@ static boolean useCustomLayouts() { |
// Query the field trial state first to ensure correct UMA reporting. |
String groupName = FieldTrialList.findFullName("WebNotificationCustomLayouts"); |
CommandLine commandLine = CommandLine.getInstance(); |
- if (commandLine.hasSwitch(ChromeSwitches.DISABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) { |
- return false; |
- } |
if (commandLine.hasSwitch(ChromeSwitches.ENABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) { |
return true; |
} |
+ if (commandLine.hasSwitch(ChromeSwitches.DISABLE_WEB_NOTIFICATION_CUSTOM_LAYOUTS)) { |
+ return false; |
+ } |
return !groupName.equals("Disabled"); |
} |