| 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..0da6482bd9b1500aa9894b852a8e02c3cc459146
|
| --- /dev/null
|
| +++ b/content/public/android/java/src/org/chromium/content_public/browser/MediaSession.java
|
| @@ -0,0 +1,57 @@
|
| +// 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);
|
| +
|
| + /**
|
| + * 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();
|
| +
|
| + /**
|
| + * Suspends the media session.
|
| + */
|
| + public abstract void suspend();
|
| +
|
| + /**
|
| + * Stops the media session.
|
| + */
|
| + public abstract void stop();
|
| +
|
| + private static native MediaSession nativeGetMediaSessionFromWebContents(WebContents contents);
|
| +}
|
|
|