| Index: third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
|
| diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
|
| index b4d77675ee0812f9f27915e01fcf752571e7c2ba..a41b2eb7c943c2c82a280e1ab8b014ef5bb4c86f 100644
|
| --- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
|
| +++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h
|
| @@ -6,11 +6,13 @@
|
| #define MediaControlsOrientationLockDelegate_h
|
|
|
| #include "core/events/EventListener.h"
|
| +#include "device/screen_orientation/public/interfaces/screen_orientation.mojom-blink.h"
|
| #include "modules/ModulesExport.h"
|
| #include "public/platform/modules/screen_orientation/WebScreenOrientationLockType.h"
|
|
|
| namespace blink {
|
|
|
| +class DeviceOrientationEvent;
|
| class Document;
|
| class HTMLVideoElement;
|
|
|
| @@ -19,14 +21,22 @@ class HTMLVideoElement;
|
| // `MediaControlsImpl` when the feature applies. Once created, it will use
|
| // events to change state.
|
| //
|
| +// The behavior depends on whether MediaControlsRotateToFullscreenDelegate is
|
| +// enabled. If it is enabled and the user has not locked the screen orientation
|
| +// at the OS level, then the orientation lock is only held until the user
|
| +// rotates their device to match the orientation of the video; otherwise it is
|
| +// held until fullscreen is exited.
|
| +//
|
| // The different states of the class are:
|
| -// - PendingFullscreen: the object is created and is waiting for the associated
|
| -// <video> to go fullscreen in order to apply an orientation lock;
|
| +// - PendingFullscreen: the object is created and it is either waiting for the
|
| +// associated <video> to go fullscreen in order to apply an orientation lock,
|
| +// or it already went fullscreen then the lock was unlocked since the user
|
| +// rotated their device, and now it is waiting until fullscreen is re-entered;
|
| // - PendingMetadata: the <video> is fullscreen but the metadata have not been
|
| // downloaded yet. It can happen because of network latency or because the
|
| // <video> went fullscreen before playback and download started;
|
| // - MaybeLockedFullscreen: the <video> is fullscreen and a screen orientation
|
| -// lock was applied.
|
| +// lock is applied.
|
| //
|
| // The possible state transitions are:
|
| // - PendingFullscreen => PendingMetadata: on fullscreenchange event (entering
|
| @@ -34,10 +44,11 @@ class HTMLVideoElement;
|
| // - PendingFullscreen => MaybeLockedFullscreen: on fullscreenchange event
|
| // (entering fullscreen) when metadata are available;
|
| // - PendingMetadata => MaybeLockedFullscreen: on loadedmetadata;
|
| -// - PendingMetadata => PendingFullscreen: on fullscreenchange event (leaving
|
| +// - PendingMetadata => PendingFullscreen: on fullscreenchange event (exiting
|
| // fullscreen);
|
| // - MaybeLockedFullscreen => PendingFullscreen: on fullscreenchange event
|
| -// (leaving fullscreen).
|
| +// (exiting fullscreen) or on deviceorientation event (rotated to match the
|
| +// orientation of the video).
|
| class MediaControlsOrientationLockDelegate final : public EventListener {
|
| public:
|
| explicit MediaControlsOrientationLockDelegate(HTMLVideoElement&);
|
| @@ -84,13 +95,20 @@ class MediaControlsOrientationLockDelegate final : public EventListener {
|
| // locked.
|
| void MaybeUnlockOrientation();
|
|
|
| + void MaybeListenToDeviceOrientation();
|
| + void GotIsAutoRotateEnabledByUser(bool enabled);
|
| +
|
| + void MaybeUnlockIfDeviceOrientationMatchesVideo(DeviceOrientationEvent*);
|
| +
|
| // Current state of the object. See comment at the top of the file for a
|
| // detailed description.
|
| State state_ = State::kPendingFullscreen;
|
|
|
| - // Whether the controls should unlock the screen orientation when possible.
|
| - // In other words, whether the orientation was locked.
|
| - bool should_unlock_orientation_ = false;
|
| + // Which lock is currently applied by this delegate.
|
| + WebScreenOrientationLockType locked_orientation_ =
|
| + kWebScreenOrientationLockDefault /* unlocked */;
|
| +
|
| + device::mojom::blink::ScreenOrientationListenerPtr monitor_;
|
|
|
| // `video_element_` owns MediaControlsImpl that owns |this|.
|
| Member<HTMLVideoElement> video_element_;
|
|
|