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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationInfo.java

Issue 1645943003: Add selection and poster support to MediaNotificationManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reply to comments Created 4 years, 11 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/media/ui/MediaNotificationInfo.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationInfo.java
index 89d4f63dfcb19dc8cd036902894d429f76db6b37..ad1a7b24aea3328ae64475b679f116ed96849f6b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationInfo.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaNotificationInfo.java
@@ -4,6 +4,8 @@
package org.chromium.chrome.browser.media.ui;
+import android.content.Intent;
+import android.graphics.Bitmap;
import android.text.TextUtils;
import org.chromium.chrome.browser.tab.Tab;
@@ -48,6 +50,8 @@ public class MediaNotificationInfo {
private int mIcon = -1;
private int mActions = ACTION_PLAY_PAUSE | ACTION_SWIPEAWAY;
private int mId = INVALID_ID;
+ private Intent mContentIntent = null;
+ private Bitmap mImage = null;
private MediaNotificationListener mListener = null;
/**
@@ -60,6 +64,7 @@ public class MediaNotificationInfo {
assert mTitle != null;
assert mOrigin != null;
assert mListener != null;
+ assert mContentIntent != null;
return new MediaNotificationInfo(
mTitle,
@@ -70,6 +75,8 @@ public class MediaNotificationInfo {
mIcon,
mActions,
mId,
+ mImage,
+ mContentIntent,
mListener);
}
@@ -113,6 +120,16 @@ public class MediaNotificationInfo {
return this;
}
+ public Builder setImage(Bitmap image) {
+ mImage = image;
+ return this;
+ }
+
+ public Builder setContentIntent(Intent intent) {
+ mContentIntent = intent;
+ return this;
+ }
+
public Builder setListener(MediaNotificationListener listener) {
mListener = listener;
return this;
@@ -160,6 +177,16 @@ public class MediaNotificationInfo {
public final int id;
/**
+ * The bitmap of the image, if any.
+ */
+ public final Bitmap image;
+
+ /**
+ * The intent to send when the notification is selected.
+ */
+ public final Intent contentIntent;
+
+ /**
* The listener for the control events.
*/
public final MediaNotificationListener listener;
@@ -192,6 +219,8 @@ public class MediaNotificationInfo {
* @param origin The origin of the tab containing the media.
* @param tabId The id of the tab containing the media.
* @param isPrivate Whether the media notification should be considered as private.
+ * @param image An image associated with the media, displayed in icons etc..
+ * @param contentIntent the intent to send when the notification is selected.
* @param listener The listener for the control events.
*/
private MediaNotificationInfo(
@@ -203,6 +232,8 @@ public class MediaNotificationInfo {
int icon,
int actions,
int id,
+ Bitmap image,
+ Intent contentIntent,
MediaNotificationListener listener) {
this.title = title;
this.isPaused = isPaused;
@@ -212,6 +243,8 @@ public class MediaNotificationInfo {
this.icon = icon;
this.mActions = actions;
this.id = id;
+ this.contentIntent = contentIntent;
+ this.image = image;
this.listener = listener;
}
@@ -229,6 +262,8 @@ public class MediaNotificationInfo {
&& id == other.id
&& TextUtils.equals(title, other.title)
&& TextUtils.equals(origin, other.origin)
+ && image == other.image || (image != null && image.sameAs(other.image))
+ && contentIntent.equals(other.contentIntent)
&& listener.equals(other.listener);
}
@@ -238,6 +273,8 @@ public class MediaNotificationInfo {
result = 31 * result + (isPrivate ? 1 : 0);
result = 31 * result + (title == null ? 0 : title.hashCode());
result = 31 * result + (origin == null ? 0 : origin.hashCode());
+ result = 31 * result + (image == null ? 0 : image.hashCode());
+ result = 31 * result + (contentIntent == null ? 0 : contentIntent.hashCode());
result = 31 * result + tabId;
result = 31 * result + icon;
result = 31 * result + mActions;

Powered by Google App Engine
This is Rietveld 408576698