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

Side by Side Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsOrientationLockDelegate.h

Issue 2919513002: [Media Controls] Prevent fullscreen orientation lock rotate glitch (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MediaControlsOrientationLockDelegate_h 5 #ifndef MediaControlsOrientationLockDelegate_h
6 #define MediaControlsOrientationLockDelegate_h 6 #define MediaControlsOrientationLockDelegate_h
7 7
8 #include "core/events/EventListener.h" 8 #include "core/events/EventListener.h"
9 #include "device/screen_orientation/public/interfaces/screen_orientation.mojom-b link.h" 9 #include "device/screen_orientation/public/interfaces/screen_orientation.mojom-b link.h"
10 #include "modules/ModulesExport.h" 10 #include "modules/ModulesExport.h"
11 #include "platform/WebTaskRunner.h"
11 #include "public/platform/modules/screen_orientation/WebScreenOrientationLockTyp e.h" 12 #include "public/platform/modules/screen_orientation/WebScreenOrientationLockTyp e.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class DeviceOrientationData; 16 class DeviceOrientationData;
16 class DeviceOrientationEvent; 17 class DeviceOrientationEvent;
17 class Document; 18 class Document;
18 class HTMLVideoElement; 19 class HTMLVideoElement;
19 20
20 // MediaControlsOrientationLockDelegate is implementing the orientation lock 21 // MediaControlsOrientationLockDelegate is implementing the orientation lock
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void MaybeUnlockOrientation(); 107 void MaybeUnlockOrientation();
107 108
108 void MaybeListenToDeviceOrientation(); 109 void MaybeListenToDeviceOrientation();
109 void GotIsAutoRotateEnabledByUser(bool enabled); 110 void GotIsAutoRotateEnabledByUser(bool enabled);
110 111
111 MODULES_EXPORT DeviceOrientation 112 MODULES_EXPORT DeviceOrientation
112 ComputeDeviceOrientation(DeviceOrientationData*) const; 113 ComputeDeviceOrientation(DeviceOrientationData*) const;
113 114
114 void MaybeUnlockIfDeviceOrientationMatchesVideo(DeviceOrientationEvent*); 115 void MaybeUnlockIfDeviceOrientationMatchesVideo(DeviceOrientationEvent*);
115 116
117 // Delay before unlocking - see `MaybeUnlockIfDeviceOrientationMatchesVideo`.
118 // Emprically, 200ms is too short, but 250ms avoids glitches. 500ms gives us
119 // a 2x margin in case the device is running slow, without being noticeable.
120 static constexpr int kUnlockDelayMs = 500;
121
116 // Current state of the object. See comment at the top of the file for a 122 // Current state of the object. See comment at the top of the file for a
117 // detailed description. 123 // detailed description.
118 State state_ = State::kPendingFullscreen; 124 State state_ = State::kPendingFullscreen;
119 125
120 // Which lock is currently applied by this delegate. 126 // Which lock is currently applied by this delegate.
121 WebScreenOrientationLockType locked_orientation_ = 127 WebScreenOrientationLockType locked_orientation_ =
122 kWebScreenOrientationLockDefault /* unlocked */; 128 kWebScreenOrientationLockDefault /* unlocked */;
123 129
130 TaskHandle unlock_task_;
131
124 device::mojom::blink::ScreenOrientationListenerPtr monitor_; 132 device::mojom::blink::ScreenOrientationListenerPtr monitor_;
125 133
126 int is_auto_rotate_enabled_by_user_for_testing_ = -1; 134 int is_auto_rotate_enabled_by_user_for_testing_ = -1;
127 135
128 // `video_element_` owns MediaControlsImpl that owns |this|. 136 // `video_element_` owns MediaControlsImpl that owns |this|.
129 Member<HTMLVideoElement> video_element_; 137 Member<HTMLVideoElement> video_element_;
130 }; 138 };
131 139
132 } // namespace blink 140 } // namespace blink
133 141
134 #endif // MediaControlsOrientationLockDelegate_h 142 #endif // MediaControlsOrientationLockDelegate_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698