GeolocationController.h [plain text]
#ifndef GeolocationController_h
#define GeolocationController_h
#if ENABLE(GEOLOCATION)
#include "Geolocation.h"
#include "Page.h"
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class GeolocationClient;
class GeolocationError;
class GeolocationPosition;
class Page;
class GeolocationController : public Supplement<Page> {
WTF_MAKE_NONCOPYABLE(GeolocationController);
public:
~GeolocationController();
static PassOwnPtr<GeolocationController> create(Page*, GeolocationClient*);
void addObserver(Geolocation*, bool enableHighAccuracy);
void removeObserver(Geolocation*);
void requestPermission(Geolocation*);
void cancelPermissionRequest(Geolocation*);
void positionChanged(GeolocationPosition*);
void errorOccurred(GeolocationError*);
GeolocationPosition* lastPosition();
GeolocationClient* client() { return m_client; }
static const char* supplementName();
static GeolocationController* from(Page* page) { return static_cast<GeolocationController*>(Supplement<Page>::from(page, supplementName())); }
private:
GeolocationController(Page*, GeolocationClient*);
GeolocationClient* m_client;
Page* m_page;
RefPtr<GeolocationPosition> m_lastPosition;
typedef HashSet<RefPtr<Geolocation> > ObserversSet;
ObserversSet m_observers;
ObserversSet m_highAccuracyObservers;
};
}
#endif // ENABLE(GEOLOCATION)
#endif // GeolocationController_h