Chromium Code Reviews| Index: content/browser/media/media_web_contents_observer.h |
| diff --git a/content/browser/media/media_web_contents_observer.h b/content/browser/media/media_web_contents_observer.h |
| index 5d6d8d2f5ff92d2f54f53bafcd1e03aa7642cab7..2a37a08d50359fe1118c2c5813331607298423f0 100644 |
| --- a/content/browser/media/media_web_contents_observer.h |
| +++ b/content/browser/media/media_web_contents_observer.h |
| @@ -42,6 +42,11 @@ class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { |
| // Called by WebContentsImpl when the audible state may have changed. |
| void MaybeUpdateAudibleState(); |
| + // Called by WebContentsImpl to know if an active player is currently |
| + // fullscreen dominant. |
| + // It should only be called while the WebContents is fullscreen. |
| + bool HasActiveFullscreenDominantVideo() const; |
|
liberato (no reviews please)
2017/02/14 23:00:01
naming is a little confusing.
personally, i'd go
mlamouri (slow - plz ping)
2017/02/17 16:36:24
Renamed to `HasActiveEffectivelyFullscreenVideo`.
|
| + |
| // WebContentsObserver implementation. |
| void WebContentsDestroyed() override; |
| void RenderFrameDeleted(RenderFrameHost* render_frame_host) override; |
| @@ -74,6 +79,12 @@ class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { |
| bool has_audio, |
| bool is_remote, |
| media::MediaContentType media_content_type); |
| + void OnMediaFullscreenChange(RenderFrameHost* render_frame_host, |
| + int delegate_id, |
| + bool is_fullscreen); |
| + void OnMediaDominantChange(RenderFrameHost* render_frame_host, |
| + int delegate_id, |
| + bool is_dominant); |
| // Clear |render_frame_host|'s tracking entry for its power save blockers. |
| void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host); |
| @@ -107,6 +118,25 @@ class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { |
| std::unique_ptr<device::PowerSaveBlocker> audio_power_save_blocker_; |
| std::unique_ptr<device::PowerSaveBlocker> video_power_save_blocker_; |
| + // FullscreenDominantInfo keeps track of whether a MediaPlayerId is fullscreen |
| + // or dominant inside a fullscreen frame. |
| + struct FullscreenDominantInfo { |
| + FullscreenDominantInfo() = delete; |
| + FullscreenDominantInfo(const FullscreenDominantInfo&) = default; |
| + FullscreenDominantInfo& operator=(const FullscreenDominantInfo&) = default; |
| + |
| + FullscreenDominantInfo(bool fullscreen, bool dominant) |
| + : fullscreen(fullscreen), dominant(dominant) {} |
| + |
| + bool fullscreen = false; |
| + bool dominant = false; |
| + }; |
| + |
| + // If the |MediaPlayerId| is set to |{ nullptr, 0 }|, |FullscreenDominantInfo| |
| + // should be ignored. |
| + std::pair<MediaPlayerId, FullscreenDominantInfo> fullscreen_dominant_video_ = |
|
liberato (no reviews please)
2017/02/14 23:00:01
nit: perhaps move MediaPlayerId into FullscreenDom
mlamouri (slow - plz ping)
2017/02/17 16:36:24
I switched to base::Optional<MediaPlayerId>. Shoul
|
| + {{nullptr, 0}, FullscreenDominantInfo(false, false)}; |
| + |
| MediaSessionControllersManager session_controllers_manager_; |
| DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); |