Index: third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.h |
diff --git a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.h b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.h |
index 14a4ec3800c8e347785a1115d9df6dcd9866ec81..65dc5ef92cd2a4468ddac6e5caa140fddc6cdf54 100644 |
--- a/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.h |
+++ b/third_party/WebKit/Source/modules/screen_orientation/ScreenOrientationControllerImpl.h |
@@ -5,9 +5,13 @@ |
#ifndef ScreenOrientationControllerImpl_h |
#define ScreenOrientationControllerImpl_h |
+#include <memory> |
+#include <utility> |
+ |
#include "core/dom/Document.h" |
#include "core/frame/ScreenOrientationController.h" |
#include "core/page/PageVisibilityObserver.h" |
+#include "device/screen_orientation/public/interfaces/screen_orientation.mojom-blink.h" |
#include "modules/ModulesExport.h" |
#include "public/platform/modules/screen_orientation/WebLockOrientationCallback.h" |
#include "public/platform/modules/screen_orientation/WebScreenOrientationLockType.h" |
@@ -16,7 +20,6 @@ |
namespace blink { |
class ScreenOrientation; |
-class WebScreenOrientationClient; |
class MODULES_EXPORT ScreenOrientationControllerImpl final |
: public ScreenOrientationController, |
@@ -37,13 +40,13 @@ class MODULES_EXPORT ScreenOrientationControllerImpl final |
void unlock() override; |
bool maybeHasActiveLock() const override; |
- static void provideTo(LocalFrame&, WebScreenOrientationClient*); |
+ static void provideTo(LocalFrame&); |
static ScreenOrientationControllerImpl* from(LocalFrame&); |
DECLARE_VIRTUAL_TRACE(); |
private: |
- ScreenOrientationControllerImpl(LocalFrame&, WebScreenOrientationClient*); |
+ ScreenOrientationControllerImpl(LocalFrame&); |
static WebScreenOrientationType computeOrientation(const IntRect&, uint16_t); |
@@ -58,14 +61,34 @@ class MODULES_EXPORT ScreenOrientationControllerImpl final |
void dispatchEventTimerFired(TimerBase*); |
+ void onLockOrientationResult( |
+ WebLockOrientationCallback*, |
+ device::mojom::blink::ScreenOrientationLockResult, |
+ WebScreenOrientationLockType); |
+ |
+ void cancelPendingLock(); |
+ |
+ bool lockMatchesCurrentOrientation(WebScreenOrientationLockType); |
+ |
bool isActive() const; |
bool isVisible() const; |
bool isActiveAndVisible() const; |
Member<ScreenOrientation> m_orientation; |
- WebScreenOrientationClient* m_client; |
+ device::mojom::blink::ScreenOrientationPtr m_remoteScreenOrientation; |
+ std::unique_ptr<WebLockOrientationCallback> m_pendingLockCallback; |
+ |
+ using CallbackLockTypeMap = |
+ std::map<std::unique_ptr<WebLockOrientationCallback>, |
+ WebScreenOrientationLockType>; |
+ |
+ // Lock orientation request has got SUCCESS response, but at that timing the |
+ // new screen orientation value carried by legacy IPC ViewMsg_Resize has not |
+ // arrived at blink side, so we pend those callbacks for such cases, until we |
+ // find that the new screen orientation arrived and matched with what we |
+ // wanted to lock to. |
+ CallbackLockTypeMap m_waitCallbacks; |
TaskRunnerTimer<ScreenOrientationControllerImpl> m_dispatchEventTimer; |
- bool m_activeLock = false; |
bool m_startedAccurateListen = false; |
}; |