webkitgeolocationpolicydecision.cpp [plain text]
#include "config.h"
#include "webkitgeolocationpolicydecision.h"
#include "Geolocation.h"
#include "webkitgeolocationpolicydecisionprivate.h"
#include "webkitglobalsprivate.h"
G_DEFINE_TYPE(WebKitGeolocationPolicyDecision, webkit_geolocation_policy_decision, G_TYPE_OBJECT);
struct _WebKitGeolocationPolicyDecisionPrivate {
WebKitWebFrame* frame;
#if ENABLE(GEOLOCATION)
WebCore::Geolocation* geolocation;
#endif
};
static void webkit_geolocation_policy_decision_class_init(WebKitGeolocationPolicyDecisionClass* decisionClass)
{
g_type_class_add_private(decisionClass, sizeof(WebKitGeolocationPolicyDecisionPrivate));
}
static void webkit_geolocation_policy_decision_init(WebKitGeolocationPolicyDecision* decision)
{
decision->priv = G_TYPE_INSTANCE_GET_PRIVATE(decision, WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION, WebKitGeolocationPolicyDecisionPrivate);
}
#if ENABLE(GEOLOCATION)
WebKitGeolocationPolicyDecision* webkit_geolocation_policy_decision_new(WebKitWebFrame* frame, WebCore::Geolocation* geolocation)
{
g_return_val_if_fail(frame, NULL);
WebKitGeolocationPolicyDecision* decision = WEBKIT_GEOLOCATION_POLICY_DECISION(g_object_new(WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION, NULL));
WebKitGeolocationPolicyDecisionPrivate* priv = decision->priv;
priv->frame = frame;
priv->geolocation = geolocation;
return decision;
}
#endif
void webkit_geolocation_policy_allow(WebKitGeolocationPolicyDecision* decision)
{
#if ENABLE(GEOLOCATION)
g_return_if_fail(WEBKIT_IS_GEOLOCATION_POLICY_DECISION(decision));
WebKitGeolocationPolicyDecisionPrivate* priv = decision->priv;
priv->geolocation->setIsAllowed(TRUE);
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Geolocation")
#endif
}
void webkit_geolocation_policy_deny(WebKitGeolocationPolicyDecision* decision)
{
#if ENABLE(GEOLOCATION)
g_return_if_fail(WEBKIT_IS_GEOLOCATION_POLICY_DECISION(decision));
WebKitGeolocationPolicyDecisionPrivate* priv = decision->priv;
priv->geolocation->setIsAllowed(FALSE);
#else
WEBKIT_WARN_FEATURE_NOT_PRESENT("Geolocation")
#endif
}