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

Unified Diff: content/browser/media/media_web_contents_observer.h

Issue 2693203002: Provide a WebContents API to discover the playback of a fullscreen video. (Closed)
Patch Set: Created 3 years, 10 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/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);
« no previous file with comments | « no previous file | content/browser/media/media_web_contents_observer.cc » ('j') | content/browser/web_contents/web_contents_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698