WebDeviceOrientationUpdateProvider.h [plain text]
#pragma once
#include "MessageReceiver.h"
#include "WebPage.h"
#include <WebCore/DeviceOrientationUpdateProvider.h>
#include <wtf/WeakHashSet.h>
#include <wtf/WeakPtr.h>
#if PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)
namespace WebKit {
class WebDeviceOrientationUpdateProvider final : public WebCore::DeviceOrientationUpdateProvider, private IPC::MessageReceiver {
public:
static Ref<WebDeviceOrientationUpdateProvider> create(WebPage& page) { return adoptRef(*new WebDeviceOrientationUpdateProvider(page));}
private:
WebDeviceOrientationUpdateProvider(WebPage&);
~WebDeviceOrientationUpdateProvider();
void startUpdatingDeviceOrientation(WebCore::MotionManagerClient&) final;
void stopUpdatingDeviceOrientation(WebCore::MotionManagerClient&) final;
void startUpdatingDeviceMotion(WebCore::MotionManagerClient&) final;
void stopUpdatingDeviceMotion(WebCore::MotionManagerClient&) final;
void deviceOrientationChanged(double, double, double, double, double) final;
void deviceMotionChanged(double, double, double, double, double, double, Optional<double>, Optional<double>, Optional<double>) final;
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
WeakPtr<WebPage> m_page;
WebCore::PageIdentifier m_pageIdentifier;
WeakHashSet<WebCore::MotionManagerClient> m_deviceOrientationClients;
WeakHashSet<WebCore::MotionManagerClient> m_deviceMotionClients;
};
}
#endif // PLATFORM(IOS_FAMILY) && ENABLE(DEVICE_ORIENTATION)