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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/MediaSessionObserver.java

Issue 2439483003: Link MediaSessionTabHelper with native MediaSession [CL is going to be split] (Closed)
Patch Set: Don't review, this CL is getting huge and needs to be split Created 4 years, 2 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: 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) {}
+}

Powered by Google App Engine
This is Rietveld 408576698