Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fc58e18a56eac62a6f39bfbc2b79cbe25a4689d0 |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content_public/common/MediaMetadata.java |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.content_public.common; |
| + |
| +import org.chromium.base.annotations.CalledByNative; |
| +import org.chromium.base.annotations.JNINamespace; |
| + |
| +/** |
| + * The MediaMetadata class carries information related to a media session. It is |
| + * the Java counterpart of content::MediaMetadata. |
| + */ |
| +@JNINamespace("content") |
| +public class MediaMetadata { |
| + |
| + /** |
| + * Title associated to the media session. |
| + */ |
| + public String title; |
|
Ted C
2016/03/01 17:18:11
Can these be final?
Not a big fan of mutable memb
mlamouri (slow - plz ping)
2016/03/16 15:47:16
Hmm, I guess I tried to use this like a struct (ie
|
| + |
| + /** |
| + * Artist name associated to the media session. |
| + */ |
| + public String artist; |
| + |
| + /** |
| + * Album name associated to the media session. |
| + */ |
| + public String album; |
| + |
| + /* |
| + * Creates a new MediaMetadat from the C++ code. This is exactly like the |
| + * constructor below apart that it can be called by native code. |
| + */ |
| + @CalledByNative |
| + private static MediaMetadata create(String title, String artist, String album) { |
| + return new MediaMetadata(title, artist, album); |
| + } |
| + |
| + /** |
| + * Creates a new MediaMetadata. |
| + */ |
| + public MediaMetadata(String title, String artist, String album) { |
| + this.title = title; |
|
Ted C
2016/03/01 17:18:11
from my comment earlier in the change, there is no
mlamouri (slow - plz ping)
2016/03/16 15:47:16
Done. Used @NonNull and checked values coming from
|
| + this.artist = artist; |
| + this.album = album; |
| + } |
| + |
| + @Override |
| + public boolean equals(Object obj) { |
| + if (obj == this) return true; |
| + if (!(obj instanceof MediaMetadata)) return false; |
| + |
| + MediaMetadata other = (MediaMetadata) obj; |
| + return title.equals(other.title) |
|
Ted C
2016/03/01 17:18:11
Use TextUtils.equals
mlamouri (slow - plz ping)
2016/03/16 15:47:16
Done.
|
| + && artist.equals(other.artist) |
| + && album.equals(other.album); |
| + } |
| + |
| + @Override |
| + public int hashCode() { |
| + int result = title == null ? 0 : title.hashCode(); |
| + result = 31 * result + (artist == null ? 0 : artist.hashCode()); |
| + result = 31 * result + (album == null ? 0 : album.hashCode()); |
| + return result; |
| + } |
| +} |