GeolocationService.cpp [plain text]
#include "config.h"
#include "GeolocationService.h"
#include "GeolocationServiceMock.h"
#include "Geoposition.h"
#include "PositionError.h"
#include <wtf/Assertions.h>
#include <wtf/CurrentTime.h>
namespace WebCore {
#if !ENABLE(GEOLOCATION) || ENABLE(CLIENT_BASED_GEOLOCATION)
static GeolocationService* createGeolocationServiceNull(GeolocationServiceClient*)
{
return 0;
}
GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &createGeolocationServiceNull;
#endif
GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
{
return (*s_factoryFunction)(client);
}
#if ENABLE(GEOLOCATION)
void GeolocationService::useMock()
{
s_factoryFunction = &GeolocationServiceMock::create;
}
GeolocationService::GeolocationService(GeolocationServiceClient* client)
: m_geolocationServiceClient(client)
{
ASSERT(m_geolocationServiceClient);
}
void GeolocationService::positionChanged()
{
m_geolocationServiceClient->geolocationServicePositionChanged(this);
}
void GeolocationService::errorOccurred()
{
m_geolocationServiceClient->geolocationServiceErrorOccurred(this);
}
#if ENABLE(GEOLOCATION_PERMISSION_CACHE)
void GeolocationService::cachePolicyChanged()
{
m_geolocationServiceClient->geolocationServiceCachePolicyChanged(this);
}
#endif
#endif
}