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

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

Issue 2453623003: Decouple MediaSession messages from WebContents (full patch) (Closed)
Patch Set: nit Created 4 years, 1 month 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..b8efc3e7b12469420e5c94a6d0a2fe441c7af01e
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content_public/browser/MediaSession.java
@@ -0,0 +1,47 @@
+// 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 android.support.annotation.Nullable;
+
+import org.chromium.base.ObserverList;
+import org.chromium.base.VisibleForTesting;
+import org.chromium.content.browser.MediaSessionImpl;
+
+/**
+ * The MediaSession Java wrapper to allow communicating with the native MediaSession object.
+ */
+public abstract class MediaSession {
+ /**
+ * @return The MediaSession associated with |contents|.
+ */
+ @Nullable
+ public static MediaSession fromWebContents(WebContents contents) {
+ // TODO(zqzhang): directly call WebContentsImpl.getMediaSession() when WebContentsImpl
+ // package restriction is removed.
+ return MediaSessionImpl.fromWebContents(contents);
+ }
+
+ /**
+ * @return The list of observers.
+ */
+ @VisibleForTesting
+ public abstract ObserverList.RewindableIterator<MediaSessionObserver> getObserversForTesting();
+
+ /**
+ * Resumes the media session.
+ */
+ public abstract void resume();
+
+ /**
+ * Suspends the media session.
+ */
+ public abstract void suspend();
+
+ /**
+ * Stops the media session.
+ */
+ public abstract void stop();
+}

Powered by Google App Engine
This is Rietveld 408576698