Chromium Code Reviews| Index: content/browser/media/session/media_session.h |
| diff --git a/content/browser/media/session/media_session.h b/content/browser/media/session/media_session.h |
| index 1cb78315bc5f4bd4e9a05600e55c6c9a5f085094..ba796b7d74736ef0353b8635ef0a299a0c33c48b 100644 |
| --- a/content/browser/media/session/media_session.h |
| +++ b/content/browser/media/session/media_session.h |
| @@ -58,12 +58,21 @@ class MediaSession : public WebContentsObserver, |
| CONTENT, |
| }; |
| + // Only visible to tests. |
| + enum class State { |
| + ACTIVE, |
| + SUSPENDED, |
| + INACTIVE |
| + }; |
| + |
| // Returns the MediaSession associated to this WebContents. Creates one if |
| // none is currently available. |
| CONTENT_EXPORT static MediaSession* Get(WebContents* web_contents); |
| ~MediaSession() override; |
| + void WasShown() override; |
|
whywhat
2016/09/13 00:16:17
nit: unused.
Zhiqiang Zhang (Slow)
2016/09/22 12:30:33
Done.
|
| + |
| void SetMetadata(const base::Optional<MediaMetadata>& metadata); |
| const base::Optional<MediaMetadata>& metadata() const { return metadata_; } |
| @@ -112,6 +121,8 @@ class MediaSession : public WebContentsObserver, |
| // recovered. |
| CONTENT_EXPORT void StopDucking(); |
| + CONTENT_EXPORT bool IsDucking() { return is_ducking_; } |
|
whywhat
2016/09/13 00:16:17
nit: ditto
Zhiqiang Zhang (Slow)
2016/09/22 12:30:33
Done.
|
| + |
| // Returns if the session can be controlled by Resume() and Suspend calls |
| // above. |
| CONTENT_EXPORT bool IsControllable() const; |
| @@ -129,6 +140,11 @@ class MediaSession : public WebContentsObserver, |
| // Returns if the session is currently suspended or inactive. |
| CONTENT_EXPORT bool IsSuspended() const; |
| + void AllowPepperOverrideDucking(); |
| + void DisallowPepperOverrideDucking(); |
| + |
| + bool HasPepper() const; |
| + |
| private: |
| friend class content::WebContentsUserData<MediaSession>; |
| friend class ::MediaSessionBrowserTest; |
| @@ -144,12 +160,6 @@ class MediaSession : public WebContentsObserver, |
| CONTENT_EXPORT void RemoveAllPlayersForTest(); |
| CONTENT_EXPORT MediaSessionUmaHelper* uma_helper_for_test(); |
| - enum class State { |
| - ACTIVE, |
| - SUSPENDED, |
| - INACTIVE |
| - }; |
| - |
| // Representation of a player for the MediaSession. |
| struct PlayerIdentifier { |
| PlayerIdentifier(MediaSessionObserver* observer, int player_id); |
| @@ -199,14 +209,19 @@ class MediaSession : public WebContentsObserver, |
| // Get the volume multiplier, which depends on whether the media session is |
| // ducking. |
| double GetVolumeMultiplier() const; |
| + double GetPepperVolumeMultiplier() const; |
| // Registers a MediaSession state change callback. |
| CONTENT_EXPORT std::unique_ptr<base::CallbackList<void(State)>::Subscription> |
| RegisterMediaSessionStateChangedCallbackForTest( |
| const StateChangedCallback& cb); |
| + CONTENT_EXPORT bool AddPepperPlayer(MediaSessionObserver* observer, |
| + int player_id); |
| + |
| std::unique_ptr<MediaSessionDelegate> delegate_; |
| PlayersMap players_; |
| + PlayersMap pepper_players_; |
| State audio_focus_state_; |
| SuspendType suspend_type_; |
| @@ -218,6 +233,9 @@ class MediaSession : public WebContentsObserver, |
| // is set to |true| after StartDucking(), and will be set to |false| after |
| // StopDucking(). |
| bool is_ducking_; |
| + // Whether allow pepper to override ducking (play in full volume) when the |
| + // session is not active. |
| + bool allow_pepper_override_ducking_; |
| base::Optional<MediaMetadata> metadata_; |
| base::CallbackList<void(State)> media_session_state_listeners_; |