NavigatorGeolocation.cpp [plain text]
#include "config.h"
#if ENABLE(GEOLOCATION)
#include "NavigatorGeolocation.h"
#include "Document.h"
#include "Frame.h"
#include "Geolocation.h"
#include "Navigator.h"
namespace WebCore {
NavigatorGeolocation::NavigatorGeolocation(Frame* frame)
: DOMWindowProperty(frame)
{
}
NavigatorGeolocation::~NavigatorGeolocation()
{
}
NavigatorGeolocation* NavigatorGeolocation::from(Navigator* navigator)
{
DEFINE_STATIC_LOCAL(AtomicString, name, ("NavigatorGeolocation"));
NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(Supplement<Navigator>::from(navigator, name));
if (!supplement) {
supplement = new NavigatorGeolocation(navigator->frame());
provideTo(navigator, name, adoptPtr(supplement));
}
return supplement;
}
void NavigatorGeolocation::resetAllGeolocationPermission()
{
if (m_geolocation)
m_geolocation->resetAllGeolocationPermission();
}
Geolocation* NavigatorGeolocation::geolocation(Navigator* navigator)
{
return NavigatorGeolocation::from(navigator)->geolocation();
}
Geolocation* NavigatorGeolocation::geolocation() const
{
if (!m_geolocation && frame())
m_geolocation = Geolocation::create(frame()->document());
return m_geolocation.get();
}
}
#endif // ENABLE(GEOLOCATION)