Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(983)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java

Issue 1750083004: Add badge to web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 f4338ea1de237dcc3367739964fa54caa31c0a86..c7665997e2de3934b4e53ef3239a2a1d5ed0a5b7 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
@@ -437,6 +437,8 @@ static int makeDefaults(int vibrationPatternLength, boolean silent) {
* text by the Android notification system.
* @param icon Icon to be displayed in the notification. Valid Bitmap icons will be scaled to
* the platforms, whereas a default icon will be generated for invalid Bitmaps.
+ * @param badge An image to represent the notification in the status bar. It is also displayed
+ * inside the notification.
* @param vibrationPattern Vibration pattern following the Web Vibration syntax.
* @param timestamp The timestamp of the event for which the notification is being shown.
* @param renotify Whether the sound, vibration, and lights should be replayed if the
@@ -448,7 +450,7 @@ static int makeDefaults(int vibrationPatternLength, boolean silent) {
*/
@CalledByNative
private void displayNotification(long persistentNotificationId, String origin, String profileId,
- boolean incognito, String tag, String title, String body, Bitmap icon,
+ boolean incognito, String tag, String title, String body, Bitmap icon, Bitmap badge,
int[] vibrationPattern, long timestamp, boolean renotify, boolean silent,
String[] actionTitles, Bitmap[] actionIcons) {
if (actionTitles.length != actionIcons.length) {
@@ -487,6 +489,7 @@ private void displayNotification(long persistentNotificationId, String origin, S
.setBody(body)
.setLargeIcon(ensureNormalizedIcon(icon, origin))
.setSmallIcon(R.drawable.ic_chrome)
+ .setSmallIcon(badge)
.setContentIntent(clickIntent)
.setDeleteIntent(closeIntent)
.setTicker(createTickerText(title, body))

Powered by Google App Engine
This is Rietveld 408576698