webkitgeolocationpolicydecision.cpp [plain text]
#include "config.h"
#include "webkitgeolocationpolicydecision.h"
#include "Geolocation.h"
#include "webkitgeolocationpolicydecisionprivate.h"
using namespace WebCore;
G_DEFINE_TYPE(WebKitGeolocationPolicyDecision, webkit_geolocation_policy_decision, G_TYPE_OBJECT);
struct _WebKitGeolocationPolicyDecisionPrivate {
WebKitWebFrame* frame;
Geolocation* geolocation;
};
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);
}
WebKitGeolocationPolicyDecision* webkit_geolocation_policy_decision_new(WebKitWebFrame* frame, 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;
}
void webkit_geolocation_policy_allow(WebKitGeolocationPolicyDecision* decision)
{
g_return_if_fail(WEBKIT_IS_GEOLOCATION_POLICY_DECISION(decision));
WebKitGeolocationPolicyDecisionPrivate* priv = decision->priv;
priv->geolocation->setIsAllowed(TRUE);
}
void webkit_geolocation_policy_deny(WebKitGeolocationPolicyDecision* decision)
{
g_return_if_fail(WEBKIT_IS_GEOLOCATION_POLICY_DECISION(decision));
WebKitGeolocationPolicyDecisionPrivate* priv = decision->priv;
priv->geolocation->setIsAllowed(FALSE);
}