Index: content/browser/media/android/media_session.h |
diff --git a/content/browser/media/android/media_session.h b/content/browser/media/android/media_session.h |
index f36bb4ef13d79f35abbb55269d149ea10be349a9..291bbf1c7c27170b42fcac3e312a622128d2df07 100644 |
--- a/content/browser/media/android/media_session.h |
+++ b/content/browser/media/android/media_session.h |
@@ -10,12 +10,15 @@ |
#include "base/android/scoped_java_ref.h" |
#include "base/id_map.h" |
#include "content/common/content_export.h" |
+#include "content/public/browser/android/media_controls_delegate.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/browser/web_contents_user_data.h" |
-namespace content { |
class MediaSessionBrowserTest; |
+ |
+namespace content { |
+ |
class MediaSessionObserver; |
// MediaSession manages the Android AudioFocus for a given WebContents. It is |
@@ -29,8 +32,9 @@ class MediaSessionObserver; |
// case of Transient and Content audio focus are both requested. |
// Android system interaction occurs in the Java counterpart to this class. |
class CONTENT_EXPORT MediaSession |
- : public content::WebContentsObserver, |
- protected content::WebContentsUserData<MediaSession> { |
+ : public WebContentsObserver, |
+ public MediaControlsDelegate, |
+ protected WebContentsUserData<MediaSession> { |
public: |
enum class Type { |
Content, |
@@ -66,21 +70,25 @@ class CONTENT_EXPORT MediaSession |
// Called by Java through JNI. |
void OnResume(JNIEnv* env, jobject obj); |
- protected: |
- friend class content::MediaSessionBrowserTest; |
+ private: |
+ friend class content::WebContentsUserData<MediaSession>; |
+ friend class ::MediaSessionBrowserTest; |
// Resets the |j_media_session_| ref to prevent calling the Java backend |
// during content_browsertests. |
void ResetJavaRefForTest(); |
- |
bool IsActiveForTest() const; |
Type audio_focus_type_for_test() const; |
+ void RemoveAllPlayersForTest(); |
- void OnSuspend(bool temporary); |
- void OnResume(); |
+ void OnSuspendInternal(bool temporary); |
+ void OnResumeInternal(); |
- private: |
- friend class content::WebContentsUserData<MediaSession>; |
+ // MediaControlsDelegate implementation. |
+ void OnControlsPause() override; |
+ void OnControlsResume() override; |
+ bool IsControllable() override; |
+ bool IsPaused() override; |
enum class State { |
Active, |
@@ -120,6 +128,8 @@ class CONTENT_EXPORT MediaSession |
// MediaSession if the audio focus really need to be abandoned. |
void AbandonSystemAudioFocusIfNeeded(); |
+ void UpdateMediaControls(); |
+ |
base::android::ScopedJavaGlobalRef<jobject> j_media_session_; |
PlayersMap players_; |