WebGeolocationManagerProxy.h [plain text]
#pragma once
#include "APIObject.h"
#include "Connection.h"
#include "MessageReceiver.h"
#include "WebContextSupplement.h"
#include <wtf/HashSet.h>
#include <wtf/text/WTFString.h>
namespace API {
class GeolocationProvider;
}
namespace WebKit {
class WebGeolocationPosition;
class WebProcessPool;
class WebGeolocationManagerProxy : public API::ObjectImpl<API::Object::Type::GeolocationManager>, public WebContextSupplement, private IPC::MessageReceiver {
public:
static const char* supplementName();
static Ref<WebGeolocationManagerProxy> create(WebProcessPool*);
void setProvider(std::unique_ptr<API::GeolocationProvider>&&);
void providerDidChangePosition(WebGeolocationPosition*);
void providerDidFailToDeterminePosition(const String& errorMessage = String());
#if PLATFORM(IOS)
void resetPermissions();
#endif
using API::Object::ref;
using API::Object::deref;
private:
explicit WebGeolocationManagerProxy(WebProcessPool*);
void processPoolDestroyed() override;
void processDidClose(WebProcessProxy*) override;
void refWebContextSupplement() override;
void derefWebContextSupplement() override;
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
bool isUpdating() const { return !m_updateRequesters.isEmpty(); }
bool isHighAccuracyEnabled() const { return !m_highAccuracyRequesters.isEmpty(); }
void startUpdating(IPC::Connection&);
void stopUpdating(IPC::Connection&);
void removeRequester(const IPC::Connection::Client*);
void setEnableHighAccuracy(IPC::Connection&, bool);
HashSet<const IPC::Connection::Client*> m_updateRequesters;
HashSet<const IPC::Connection::Client*> m_highAccuracyRequesters;
std::unique_ptr<API::GeolocationProvider> m_provider;
};
}