Index: content/public/android/java/src/org/chromium/content/browser/MediaSessionObserver.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/MediaSessionObserver.java b/content/public/android/java/src/org/chromium/content/browser/MediaSessionObserver.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..791298c6e6684b4ce09c643e464aa3bc21978f71 |
--- /dev/null |
+++ b/content/public/android/java/src/org/chromium/content/browser/MediaSessionObserver.java |
@@ -0,0 +1,50 @@ |
+// 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.browser; |
+ |
+import org.chromium.content_public.common.MediaMetadata; |
+ |
+/** |
+ * Java MediaSessionObserver. The observer is proxied via Java ChromeMediaSession and does not have |
+ * a native counterpart. |
+ */ |
+public class MediaSessionObserver { |
+ // The observed MediaSession. |
+ private ChromeMediaSession mSession; |
+ |
+ /** |
+ * Create a MediaSessionObserver observing |session|. |
+ */ |
+ public MediaSessionObserver(ChromeMediaSession session) { |
+ session.addObserver(this); |
+ mSession = session; |
+ } |
+ |
+ /** |
+ * Get the observed MediaSession. |
+ */ |
+ public final ChromeMediaSession getSession() { |
+ return mSession; |
+ } |
+ |
+ /** |
+ * Called when MediaSession is destroyed. |
+ */ |
+ public void mediaSessionDestroyed() {} |
+ |
+ /** |
+ * Called when the native {@link MediaSession} state has changed. |
+ * @param isControllable Whether the native {@link MediaSession} is controllable. |
+ * @param isSuspended Whether the native {@link MediaSession} is suspended. |
+ */ |
+ public void mediaSessionStateChanged(boolean isControllable, boolean isSuspended) {} |
+ |
+ /** |
+ * Called when the native {@link MediaSession} has changed metadata. |
+ * @param metadata The new metadata of the native {@link MediaSession}. "null" is for unsetting |
+ * metadata. |
+ */ |
+ public void mediaSessionMetadataChanged(MediaMetadata metadata) {} |
+} |