WebGeolocationPolicyListener.cpp [plain text]
#include "WebKitDLL.h"
#include "WebGeolocationPolicyListener.h"
#include <WebCore/Geolocation.h>
using namespace WebCore;
COMPtr<WebGeolocationPolicyListener> WebGeolocationPolicyListener::createInstance(RefPtr<Geolocation>&& geolocation)
{
return new WebGeolocationPolicyListener(WTFMove(geolocation));
}
WebGeolocationPolicyListener::WebGeolocationPolicyListener(RefPtr<Geolocation>&& geolocation)
: m_refCount(0)
, m_geolocation(WTFMove(geolocation))
{
gClassCount++;
gClassNameCount().add("WebGeolocationPolicyListener");
}
WebGeolocationPolicyListener::~WebGeolocationPolicyListener()
{
gClassCount--;
gClassNameCount().remove("WebGeolocationPolicyListener");
}
HRESULT WebGeolocationPolicyListener::QueryInterface(_In_ REFIID riid, _COM_Outptr_ void** ppvObject)
{
if (!ppvObject)
return E_POINTER;
*ppvObject = nullptr;
if (IsEqualIID(riid, __uuidof(IUnknown)))
*ppvObject = static_cast<IWebGeolocationPolicyListener*>(this);
else if (IsEqualIID(riid, __uuidof(IWebGeolocationPolicyListener)))
*ppvObject = static_cast<IWebGeolocationPolicyListener*>(this);
else
return E_NOINTERFACE;
AddRef();
return S_OK;
}
ULONG WebGeolocationPolicyListener::AddRef()
{
return ++m_refCount;
}
ULONG WebGeolocationPolicyListener::Release()
{
ULONG newRef = --m_refCount;
if (!newRef)
delete this;
return newRef;
}
HRESULT WebGeolocationPolicyListener::allow()
{
m_geolocation->setIsAllowed(true);
return S_OK;
}
HRESULT WebGeolocationPolicyListener::deny()
{
m_geolocation->setIsAllowed(false);
return S_OK;
}