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

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

Issue 2444833004: Decouple MediaSession/MediaSessionObserver from WebContents in Java[OBSOLETE, go to the combined CL] (Closed)
Patch Set: addressed nits from jam@ 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_public/browser/MediaSession.java
diff --git a/content/public/android/java/src/org/chromium/content_public/browser/MediaSession.java b/content/public/android/java/src/org/chromium/content_public/browser/MediaSession.java
new file mode 100644
index 0000000000000000000000000000000000000000..a8cab03082c2edaef3c94f998271e1969d235dad
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content_public/browser/MediaSession.java
@@ -0,0 +1,54 @@
+// 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.browser;
+
+import org.chromium.base.ObserverList;
+import org.chromium.base.VisibleForTesting;
+import org.chromium.base.annotations.JNINamespace;
+
+/**
+ * The MediaSession Java wrapper to allow communicating with the native MediaSession object.
+ */
+@JNINamespace("content")
+public abstract class MediaSession {
+ /**
+ * @return The MediaSession associated with |contents|.
+ */
+ public static MediaSession fromWebContents(WebContents contents) {
+ return nativeGetMediaSessionFromWebContents(contents);
+ }
+
+ /**
+ * Add an observer to the MediaSession.
+ * @param observer The observer to add.
+ */
+ public abstract void addObserver(MediaSessionObserver observer);
+ /**
mlamouri (slow - plz ping) 2016/10/28 10:24:50 style: leave empty line after `addObserver`
Zhiqiang Zhang (Slow) 2016/10/28 11:18:48 Done.
+ * Add an observer to the MediaSession.
+ * @param observer The observer to remove.
+ */
+ public abstract void removeObserver(MediaSessionObserver observer);
+
+ /**
+ * @return The list of observers.
+ */
+ @VisibleForTesting
+ public abstract ObserverList.RewindableIterator<MediaSessionObserver> getObserversForTesting();
+
+ /**
+ * Resumes the media session.
+ */
+ public abstract void resume();
+ /**
mlamouri (slow - plz ping) 2016/10/28 10:24:50 style: leave empty line after `resume`
Zhiqiang Zhang (Slow) 2016/10/28 11:18:48 Done.
+ * Suspends the media session.
+ */
+ public abstract void suspend();
+ /**
mlamouri (slow - plz ping) 2016/10/28 10:24:50 style: leave empty line after `suspend`
Zhiqiang Zhang (Slow) 2016/10/28 11:18:48 Done.
+ * Stops the media session.
+ */
+ public abstract void stop();
+
+ private static native MediaSession nativeGetMediaSessionFromWebContents(WebContents contents);
+}

Powered by Google App Engine
This is Rietveld 408576698