| Index: Source/modules/screen_orientation/ScreenOrientationController.cpp
|
| diff --git a/Source/modules/screen_orientation/ScreenOrientationController.cpp b/Source/modules/screen_orientation/ScreenOrientationController.cpp
|
| index bc0564bc05c15bace8d11c0b2622735bd1faaa26..b469dd755d273671e64b9cd4e331ef4d479ccee1 100644
|
| --- a/Source/modules/screen_orientation/ScreenOrientationController.cpp
|
| +++ b/Source/modules/screen_orientation/ScreenOrientationController.cpp
|
| @@ -10,6 +10,7 @@
|
| #include "core/frame/LocalFrame.h"
|
| #include "core/page/Page.h"
|
| #include "modules/screen_orientation/ScreenOrientation.h"
|
| +#include "modules/screen_orientation/ScreenOrientationDispatcher.h"
|
| #include "platform/LayoutTestSupport.h"
|
| #include "platform/PlatformScreen.h"
|
| #include "public/platform/WebScreenOrientationClient.h"
|
| @@ -40,7 +41,7 @@ ScreenOrientationController* ScreenOrientationController::from(LocalFrame& frame
|
| }
|
|
|
| ScreenOrientationController::ScreenOrientationController(LocalFrame& frame, blink::WebScreenOrientationClient* client)
|
| - : PageLifecycleObserver(frame.page())
|
| + : PlatformEventController(frame.page())
|
| , m_client(client)
|
| , m_frame(frame)
|
| , m_dispatchEventTimer(this, &ScreenOrientationController::dispatchEventTimerFired)
|
| @@ -96,6 +97,8 @@ void ScreenOrientationController::updateOrientation()
|
|
|
| void ScreenOrientationController::pageVisibilityChanged()
|
| {
|
| + notifyDispatcher();
|
| +
|
| if (!m_orientation || !page() || page()->visibilityState() != PageVisibilityStateVisible)
|
| return;
|
|
|
| @@ -147,6 +150,7 @@ void ScreenOrientationController::setOrientation(ScreenOrientation* orientation)
|
| m_orientation = orientation;
|
| if (m_orientation)
|
| updateOrientation();
|
| + notifyDispatcher();
|
| }
|
|
|
| void ScreenOrientationController::lock(blink::WebScreenOrientationLockType orientation, blink::WebLockOrientationCallback* callback)
|
| @@ -173,6 +177,34 @@ void ScreenOrientationController::dispatchEventTimerFired(Timer<ScreenOrientatio
|
| m_orientation->dispatchEvent(Event::create(EventTypeNames::change));
|
| }
|
|
|
| +void ScreenOrientationController::didUpdateData()
|
| +{
|
| + // Do nothing.
|
| +}
|
| +
|
| +void ScreenOrientationController::registerWithDispatcher()
|
| +{
|
| + ScreenOrientationDispatcher::instance().addController(this);
|
| +}
|
| +
|
| +void ScreenOrientationController::unregisterWithDispatcher()
|
| +{
|
| + ScreenOrientationDispatcher::instance().removeController(this);
|
| +}
|
| +
|
| +bool ScreenOrientationController::hasLastData()
|
| +{
|
| + return true;
|
| +}
|
| +
|
| +void ScreenOrientationController::notifyDispatcher()
|
| +{
|
| + if (m_orientation && page()->visibilityState() == PageVisibilityStateVisible)
|
| + startUpdating();
|
| + else
|
| + stopUpdating();
|
| +}
|
| +
|
| void ScreenOrientationController::trace(Visitor* visitor)
|
| {
|
| visitor->trace(m_orientation);
|
|
|