Provide a WebContents API to discover the playback of a fullscreen video.
That means a video is playing fullscreen, either directly (native controls) or
indirectly (custom controls). This is only exposed to the Java WebContents API
at the moment.
BUG=690960
Review-Url: https://codereview.chromium.org/2693203002
Cr-Commit-Position: refs/heads/master@{#452487}
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc
index f8225d5..842b860 100644
--- a/content/browser/web_contents/web_contents_android.cc
+++ b/content/browser/web_contents/web_contents_android.cc
@@ -710,6 +710,12 @@
web_contents_->SetHasPersistentVideo(value);
}
+bool WebContentsAndroid::HasActiveEffectivelyFullscreenVideo(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj) {
+ return web_contents_->HasActiveEffectivelyFullscreenVideo();
+}
+
void WebContentsAndroid::OnFinishGetContentBitmap(
const JavaRef<jobject>& obj,
const JavaRef<jobject>& callback,
diff --git a/content/browser/web_contents/web_contents_android.h b/content/browser/web_contents/web_contents_android.h
index 93fc028..171006b5 100644
--- a/content/browser/web_contents/web_contents_android.h
+++ b/content/browser/web_contents/web_contents_android.h
@@ -196,6 +196,9 @@
void SetHasPersistentVideo(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
jboolean value);
+ bool HasActiveEffectivelyFullscreenVideo(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj);
void SetMediaSession(
const base::android::ScopedJavaLocalRef<jobject>& j_media_session);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 244b5d4..307e3fc 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4255,6 +4255,10 @@
return has_persistent_video_;
}
+bool WebContentsImpl::HasActiveEffectivelyFullscreenVideo() const {
+ return media_web_contents_observer_->HasActiveEffectivelyFullscreenVideo();
+}
+
bool WebContentsImpl::IsFocusedElementEditable() {
RenderFrameHostImpl* frame = GetFocusedFrame();
return frame && frame->has_focused_editable_element();
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 813e35e..7c26aa8f 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -793,6 +793,13 @@
// Called when the WebContents gains or loses a persistent video.
void SetHasPersistentVideo(bool value);
+ // Whether the WebContents has an active player is effectively fullscreen.
+ // That means that the video is either fullscreen or it is the content of
+ // a fullscreen page (in other words, a fullscreen video with custom
+ // controls).
+ // |IsFullscreen| must return |true| when this method is called.
+ bool HasActiveEffectivelyFullscreenVideo() const;
+
#if defined(OS_ANDROID)
// Called by FindRequestManager when all of the find match rects are in.
void NotifyFindMatchRectsReply(int version,