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

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

Issue 2274873003: Letting Flash join MediaSession (stack implementaion) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_session_type
Patch Set: tuned some behavior details and addressed Anton's comments (Left some comments here) 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 9d501fcfd8b7324f41eaf052962620b96e4c43fb..ce800125d895e796ec948caa697cfa7b6f8710b4 100644
--- a/content/browser/media/session/media_session.h
+++ b/content/browser/media/session/media_session.h
@@ -63,6 +63,8 @@ class MediaSession : public WebContentsObserver,
~MediaSession() override;
+ void WasShown() override;
+
void SetMetadata(const MediaMetadata& metadata);
const MediaMetadata& metadata() const { return metadata_; }
@@ -111,6 +113,8 @@ class MediaSession : public WebContentsObserver,
// recovered.
CONTENT_EXPORT void StopDucking();
+ CONTENT_EXPORT bool IsDucking() { return is_ducking_; }
+
// Returns if the session can be controlled by Resume() and Suspend calls
// above.
CONTENT_EXPORT bool IsControllable() const;
@@ -128,6 +132,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;
@@ -198,14 +207,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_;
@@ -217,6 +231,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_;
MediaMetadata metadata_;
base::CallbackList<void(State)> media_session_state_listeners_;

Powered by Google App Engine
This is Rietveld 408576698