#ifndef GeoNotifier_h
#define GeoNotifier_h
#if ENABLE(GEOLOCATION)
#include "Timer.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace WebCore {
class Geoposition;
class Geolocation;
class PositionCallback;
class PositionError;
class PositionErrorCallback;
class PositionOptions;
class GeoNotifier : public RefCounted<GeoNotifier> {
public:
static Ref<GeoNotifier> create(Geolocation& geolocation, PassRefPtr<PositionCallback> positionCallback, PassRefPtr<PositionErrorCallback> positionErrorCallback, PassRefPtr<PositionOptions> options)
{
return adoptRef(*new GeoNotifier(geolocation, positionCallback, positionErrorCallback, options));
}
PositionOptions* options() const { return m_options.get(); }
void setFatalError(PassRefPtr<PositionError>);
bool useCachedPosition() const { return m_useCachedPosition; }
void setUseCachedPosition();
void runSuccessCallback(Geoposition*);
void runErrorCallback(PositionError*);
void startTimerIfNeeded();
void stopTimer();
void timerFired();
bool hasZeroTimeout() const;
private:
GeoNotifier(Geolocation&, PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
Ref<Geolocation> m_geolocation;
RefPtr<PositionCallback> m_successCallback;
RefPtr<PositionErrorCallback> m_errorCallback;
RefPtr<PositionOptions> m_options;
Timer m_timer;
RefPtr<PositionError> m_fatalError;
bool m_useCachedPosition;
};
}
#endif // ENABLE(GEOLOCATION)
#endif // GeoNotifier_h