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 27da86920008aac063b002b2e1bc64b50537c29c..d2ac59f3d54177aac7d875a33e2649b295ad3580 100644 |
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h |
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h |
@@ -8,6 +8,7 @@ |
#include "core/events/EventListener.h" |
#include "device/screen_orientation/public/interfaces/screen_orientation.mojom-blink.h" |
#include "modules/ModulesExport.h" |
+#include "platform/WebTaskRunner.h" |
#include "platform/wtf/Optional.h" |
#include "public/platform/modules/screen_orientation/WebScreenOrientationLockType.h" |
@@ -114,6 +115,11 @@ class MediaControlsOrientationLockDelegate final : public EventListener { |
void MaybeUnlockIfDeviceOrientationMatchesVideo(DeviceOrientationEvent*); |
+ // Delay before unlocking - see `MaybeUnlockIfDeviceOrientationMatchesVideo`. |
+ // Emprically, 200ms is too short, but 250ms avoids glitches. 500ms gives us |
+ // a 2x margin in case the device is running slow, without being noticeable. |
+ static constexpr int kUnlockDelayMs = 500; |
+ |
// Current state of the object. See comment at the top of the file for a |
// detailed description. |
State state_ = State::kPendingFullscreen; |
@@ -122,6 +128,8 @@ class MediaControlsOrientationLockDelegate final : public EventListener { |
WebScreenOrientationLockType locked_orientation_ = |
kWebScreenOrientationLockDefault /* unlocked */; |
+ TaskHandle unlock_task_; |
+ |
device::mojom::blink::ScreenOrientationListenerPtr monitor_; |
WTF::Optional<bool> is_auto_rotate_enabled_by_user_override_for_testing_; |