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

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 2756553002: Force the video to go fullscreen when setting persistent video (Closed)
Patch Set: addressed nits Created 3 years, 9 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: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 12bdeea91444eca4108add71383687c328564f5f..7fa17e2b42c67ae4901a253a4c08bc9aabcc3cd6 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -36,6 +36,7 @@
#include "core/css/MediaList.h"
#include "core/dom/Attribute.h"
#include "core/dom/DOMException.h"
+#include "core/dom/DocumentUserGestureToken.h"
#include "core/dom/ElementTraversal.h"
#include "core/dom/ElementVisibilityObserver.h"
#include "core/dom/Fullscreen.h"
@@ -465,7 +466,8 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName,
m_remotePlaybackClient(nullptr),
m_autoplayVisibilityObserver(nullptr),
m_mediaControls(nullptr),
- m_controlsList(HTMLMediaElementControlsList::create(this)) {
+ m_controlsList(HTMLMediaElementControlsList::create(this)),
+ m_isPersistentVideo(false) {
BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")";
m_lockedPendingUserGesture = computeLockedPendingUserGesture(document);
@@ -3234,6 +3236,28 @@ void HTMLMediaElement::remotePlaybackStarted() {
remotePlaybackClient()->stateChanged(WebRemotePlaybackState::Connected);
}
+// TODO(zqzhang): move logic for hiding controls here.
+void HTMLMediaElement::onBecamePersistentVideo(bool value) {
+ if (!isHTMLVideoElement())
+ return;
+
+ if (value) {
+ if (isFullscreen())
+ return;
+
+ UserGestureIndicator gestureIndicator(
+ DocumentUserGestureToken::create(&document()));
+ Fullscreen::requestFullscreen(*this);
+ m_isPersistentVideo = true;
+ } else {
+ if (!m_isPersistentVideo)
+ return;
+
+ Fullscreen::exitFullscreen(document());
+ m_isPersistentVideo = false;
+ }
+}
+
bool HTMLMediaElement::hasSelectedVideoTrack() {
DCHECK(RuntimeEnabledFeatures::backgroundVideoTrackOptimizationEnabled());

Powered by Google App Engine
This is Rietveld 408576698