| Index: content/public/android/java/src/org/chromium/content_public/common/MediaMetadata.java
|
| diff --git a/content/public/android/java/src/org/chromium/content_public/common/MediaMetadata.java b/content/public/android/java/src/org/chromium/content_public/common/MediaMetadata.java
|
| index a1e982869563666dd3c1c09d5b083da7bd780092..9ba83d805bb530e42ce7e1b5e2f897dc37ca1ed9 100644
|
| --- a/content/public/android/java/src/org/chromium/content_public/common/MediaMetadata.java
|
| +++ b/content/public/android/java/src/org/chromium/content_public/common/MediaMetadata.java
|
| @@ -4,18 +4,64 @@
|
|
|
| package org.chromium.content_public.common;
|
|
|
| +import android.graphics.Rect;
|
| import android.support.annotation.NonNull;
|
| import android.text.TextUtils;
|
|
|
| import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.base.annotations.JNINamespace;
|
|
|
| +import java.util.ArrayList;
|
| +import java.util.List;
|
| +
|
| /**
|
| * The MediaMetadata class carries information related to a media session. It is
|
| * the Java counterpart of content::MediaMetadata.
|
| */
|
| @JNINamespace("content")
|
| public class MediaMetadata {
|
| + /**
|
| + * The Artwork class carries the artwork information in MediaMetadata. It is the Java
|
| + * counterpart of content::MediaMetadata::Artwork.
|
| + */
|
| + public static class Artwork {
|
| + @NonNull
|
| + private String mSrc;
|
| +
|
| + private String mType;
|
| +
|
| + @NonNull
|
| + private List<Rect> mSizes = new ArrayList<Rect>();
|
| +
|
| + public Artwork(@NonNull String src, String type) {
|
| + mSrc = src;
|
| + mType = type;
|
| + }
|
| +
|
| + public String getSrc() {
|
| + return mSrc;
|
| + }
|
| +
|
| + public String getType() {
|
| + return mType;
|
| + }
|
| +
|
| + public List<Rect> getSizes() {
|
| + return mSizes;
|
| + }
|
| +
|
| + public void setSrc(String src) {
|
| + mSrc = src;
|
| + }
|
| +
|
| + public void setType(String type) {
|
| + mType = type;
|
| + }
|
| +
|
| + public void addSize(Rect size) {
|
| + mSizes.add(size);
|
| + }
|
| + }
|
|
|
| @NonNull
|
| private String mTitle;
|
| @@ -26,6 +72,9 @@ public class MediaMetadata {
|
| @NonNull
|
| private String mAlbum;
|
|
|
| + @NonNull
|
| + private List<Artwork> mArtworks = new ArrayList<Artwork>();
|
| +
|
| /**
|
| * Returns the title associated with the media session.
|
| */
|
| @@ -47,6 +96,10 @@ public class MediaMetadata {
|
| return mAlbum;
|
| }
|
|
|
| + public List<Artwork> getArtworks() {
|
| + return mArtworks;
|
| + }
|
| +
|
| /**
|
| * Sets the title associated with the media session.
|
| * @param title The title to use for the media session.
|
| @@ -71,6 +124,16 @@ public class MediaMetadata {
|
| mAlbum = album;
|
| }
|
|
|
| + @CalledByNative
|
| + private void addArtwork(Artwork artwork) {
|
| + mArtworks.add(artwork);
|
| + }
|
| +
|
| + @CalledByNative
|
| + private static void addArtworkSize(Artwork artwork, int width, int height) {
|
| + artwork.addSize(new Rect(0, 0, width, height));
|
| + }
|
| +
|
| /**
|
| * Creates a new MediaMetadata from the C++ code. This is exactly like the
|
| * constructor below apart that it can be called by native code.
|
| @@ -81,6 +144,11 @@ public class MediaMetadata {
|
| album == null ? "" : album);
|
| }
|
|
|
| + @CalledByNative
|
| + private static Artwork createArtwork(String src, String type) {
|
| + return new Artwork(src == null ? "" : src, type);
|
| + }
|
| +
|
| /**
|
| * Creates a new MediaMetadata.
|
| */
|
|
|