Index: third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
index 227a699e50ef135548a91979550a1ffee8388c58..c8b56114fb6e6b3c4f84f7c07d7d5bac88abb4b7 100644 |
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp |
@@ -45,6 +45,7 @@ |
#include "core/layout/LayoutTheme.h" |
#include "modules/media_controls/MediaControlsMediaEventListener.h" |
#include "modules/media_controls/MediaControlsOrientationLockDelegate.h" |
+#include "modules/media_controls/MediaControlsRotateToFullscreenDelegate.h" |
#include "modules/media_controls/MediaControlsWindowEventListener.h" |
#include "modules/media_controls/elements/MediaControlCastButtonElement.h" |
#include "modules/media_controls/elements/MediaControlCurrentTimeDisplayElement.h" |
@@ -223,6 +224,7 @@ MediaControlsImpl::MediaControlsImpl(HTMLMediaElement& media_element) |
WTF::Bind(&MediaControlsImpl::HideAllMenus, |
WrapWeakPersistent(this)))), |
orientation_lock_delegate_(nullptr), |
+ rotate_to_fullscreen_delegate_(nullptr), |
hide_media_controls_timer_( |
TaskRunnerHelper::Get(TaskType::kUnspecedTimer, |
&media_element.GetDocument()), |
@@ -250,9 +252,18 @@ MediaControlsImpl* MediaControlsImpl::Create(HTMLMediaElement& media_element, |
controls->InitializeControls(); |
controls->Reset(); |
- // Initialize the orientation lock when going fullscreen feature. |
- if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() && |
+ // RotateToFullscreen and FullscreenOrientationLock are not yet compatible |
+ // so enabling RotateToFullscreen disables FullscreenOrientationLock. |
+ // TODO(johnme): Make it possible to use both features simultaneously. |
+ if (RuntimeEnabledFeatures::videoRotateToFullscreenEnabled() && |
media_element.IsHTMLVideoElement()) { |
+ // Initialize the rotate-to-fullscreen feature. |
+ controls->rotate_to_fullscreen_delegate_ = |
+ new MediaControlsRotateToFullscreenDelegate( |
+ toHTMLVideoElement(media_element)); |
+ } else if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() && |
+ media_element.IsHTMLVideoElement()) { |
+ // Initialize the orientation lock when going fullscreen feature. |
controls->orientation_lock_delegate_ = |
new MediaControlsOrientationLockDelegate( |
toHTMLVideoElement(media_element)); |
@@ -410,6 +421,8 @@ Node::InsertionNotificationRequest MediaControlsImpl::InsertedInto( |
media_event_listener_->Attach(); |
if (orientation_lock_delegate_) |
orientation_lock_delegate_->Attach(); |
+ if (rotate_to_fullscreen_delegate_) |
+ rotate_to_fullscreen_delegate_->Attach(); |
if (!resize_observer_) { |
resize_observer_ = |
@@ -432,6 +445,8 @@ void MediaControlsImpl::RemovedFrom(ContainerNode*) { |
media_event_listener_->Detach(); |
if (orientation_lock_delegate_) |
orientation_lock_delegate_->Detach(); |
+ if (rotate_to_fullscreen_delegate_) |
+ rotate_to_fullscreen_delegate_->Detach(); |
resize_observer_.Clear(); |
} |
@@ -1132,6 +1147,7 @@ DEFINE_TRACE(MediaControlsImpl) { |
visitor->Trace(media_event_listener_); |
visitor->Trace(window_event_listener_); |
visitor->Trace(orientation_lock_delegate_); |
+ visitor->Trace(rotate_to_fullscreen_delegate_); |
MediaControls::Trace(visitor); |
HTMLDivElement::Trace(visitor); |
} |