WebGeolocationManagerProxy.h [plain text]
#ifndef WebGeolocationManagerProxy_h
#define WebGeolocationManagerProxy_h
#include "APIObject.h"
#include "Connection.h"
#include "MessageReceiver.h"
#include "WebContextSupplement.h"
#include "WebGeolocationProvider.h"
#include <wtf/HashSet.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
class WebContext;
class WebGeolocationPosition;
class WebGeolocationManagerProxy : public API::ObjectImpl<API::Object::Type::GeolocationManager>, public WebContextSupplement, private IPC::MessageReceiver {
public:
static const char* supplementName();
static PassRefPtr<WebGeolocationManagerProxy> create(WebContext*);
void initializeProvider(const WKGeolocationProviderBase*);
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(WebContext*);
virtual void contextDestroyed() override;
virtual void processDidClose(WebProcessProxy*) override;
virtual void refWebContextSupplement() override;
virtual void derefWebContextSupplement() override;
virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) 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;
WebGeolocationProvider m_provider;
};
}
#endif // WebGeolocationManagerProxy_h