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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 2556573003: Media: lock orientation when <video> goes fullscreen. (Closed)
Patch Set: review comments Created 4 years 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/shadow/MediaControls.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
index c7685babd45c0dc954c0a852c454b8367de70065..c56b9e76a7109593cc2a0a96cc353c1cc59f7fea 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
@@ -32,7 +32,9 @@
#include "core/events/MouseEvent.h"
#include "core/frame/Settings.h"
#include "core/html/HTMLMediaElement.h"
+#include "core/html/HTMLVideoElement.h"
#include "core/html/shadow/MediaControlsMediaEventListener.h"
+#include "core/html/shadow/MediaControlsOrientationLockDelegate.h"
#include "core/html/shadow/MediaControlsWindowEventListener.h"
#include "core/html/track/TextTrackContainer.h"
#include "core/html/track/TextTrackList.h"
@@ -127,6 +129,7 @@ MediaControls::MediaControls(HTMLMediaElement& mediaElement)
m_windowEventListener(MediaControlsWindowEventListener::create(
this,
WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))),
+ m_orientationLockDelegate(nullptr),
m_hideMediaControlsTimer(this,
&MediaControls::hideMediaControlsTimerFired),
m_hideTimerBehaviorFlags(IgnoreNone),
@@ -141,6 +144,15 @@ MediaControls* MediaControls::create(HTMLMediaElement& mediaElement) {
MediaControls* controls = new MediaControls(mediaElement);
controls->setShadowPseudoId(AtomicString("-webkit-media-controls"));
controls->initializeControls();
+
+ // Initialize the orientation lock when going fullscreen feature.
+ if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() &&
+ mediaElement.isHTMLVideoElement()) {
+ controls->m_orientationLockDelegate =
+ new MediaControlsOrientationLockDelegate(
+ toHTMLVideoElement(mediaElement));
+ }
+
return controls;
}
@@ -924,6 +936,7 @@ DEFINE_TRACE(MediaControls) {
visitor->trace(m_overlayCastButton);
visitor->trace(m_mediaEventListener);
visitor->trace(m_windowEventListener);
+ visitor->trace(m_orientationLockDelegate);
HTMLDivElement::trace(visitor);
}

Powered by Google App Engine
This is Rietveld 408576698