Chromium Code Reviews| 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..3d7f83eba362966f90583d3e3e40675eecb4e827 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,24 @@ class CONTENT_EXPORT MediaSession |
| // Called by Java through JNI. |
| void OnResume(JNIEnv* env, jobject obj); |
| - protected: |
|
mlamouri (slow - plz ping)
2015/06/18 16:43:23
I had that so we had a very specific layer exposed
whywhat
2015/06/19 16:00:34
If you declare a friend class it has access to all
mlamouri (slow - plz ping)
2015/06/22 14:34:17
May I give you my resignation? :)
|
| - 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(); |
| - private: |
| - friend class content::WebContentsUserData<MediaSession>; |
| + // MediaControlsDelegate implementation. |
| + void OnControlsPause() override; |
| + void OnControlsResume() override; |
| + bool IsPaused() override; |
| enum class State { |
| Active, |
| @@ -120,6 +127,12 @@ class CONTENT_EXPORT MediaSession |
| // MediaSession if the audio focus really need to be abandoned. |
| void AbandonSystemAudioFocusIfNeeded(); |
| + // Shows media controls if the type is right and WebContentsDelegate is set. |
| + void ShowMediaControlsIfNeeded(Type type); |
| + |
| + // Hides media controls if the type is right and WebContentsDelegate is set. |
| + void HideMediaControlsIfNeeded(Type type); |
| + |
| base::android::ScopedJavaGlobalRef<jobject> j_media_session_; |
| PlayersMap players_; |