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

Unified Diff: content/browser/media/session/media_session.h

Issue 2381963004: Reland "Letting Flash join MediaSession (stack implementaion)" (Closed)
Patch Set: Created 4 years, 3 months 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/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..ba8f9995df9f0b30830e0765bbdac870614f5a23 100644
--- a/content/browser/media/session/media_session.h
+++ b/content/browser/media/session/media_session.h
@@ -58,6 +58,13 @@ 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);
@@ -124,11 +131,23 @@ class MediaSession : public WebContentsObserver,
// instead of checking if the state is SUSPENDED. In order to not have to
// change all the callers and make the current refactoring ridiculously huge,
// this method is introduced temporarily and will be removed later.
- bool IsReallySuspended() const;
+ CONTENT_EXPORT bool IsReallySuspended() const;
// Returns if the session is currently suspended or inactive.
CONTENT_EXPORT bool IsSuspended() const;
+ // Returns the audio focus type. The type is updated everytime after the
+ // session requests audio focus.
+ CONTENT_EXPORT AudioFocusManager::AudioFocusType audio_focus_type() const {
+ return audio_focus_type_;
+ }
+
+ // Returns whether the session has Pepper instances.
+ bool HasPepper() const;
+
+ // WebContentsObserver implementation
+ void WebContentsDestroyed() override;
+
private:
friend class content::WebContentsUserData<MediaSession>;
friend class ::MediaSessionBrowserTest;
@@ -139,17 +158,9 @@ class MediaSession : public WebContentsObserver,
CONTENT_EXPORT void SetDelegateForTests(
std::unique_ptr<MediaSessionDelegate> delegate);
CONTENT_EXPORT bool IsActiveForTest() const;
- CONTENT_EXPORT AudioFocusManager::AudioFocusType audio_focus_type_for_test()
- const;
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);
@@ -179,12 +190,12 @@ class MediaSession : public WebContentsObserver,
// Requests audio focus to the MediaSessionDelegate.
// Returns whether the request was granted.
- bool RequestSystemAudioFocus(
+ CONTENT_EXPORT bool RequestSystemAudioFocus(
AudioFocusManager::AudioFocusType audio_focus_type);
// To be called after a call to AbandonAudioFocus() in order request the
// delegate to abandon the audio focus.
- void AbandonSystemAudioFocusIfNeeded();
+ CONTENT_EXPORT void AbandonSystemAudioFocusIfNeeded();
// Notifies WebContents about the state change of the media session.
void UpdateWebContents();
@@ -205,8 +216,12 @@ class MediaSession : public WebContentsObserver,
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_;
« no previous file with comments | « content/browser/media/session/audio_focus_manager_unittest.cc ('k') | content/browser/media/session/media_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698