2 * Copyright (C) 2010 Arno Renevier
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 #include "webkitgeolocationpolicydecision.h"
23 #include "webkitprivate.h"
24 #include "Geolocation.h"
26 using namespace WebKit;
27 using namespace WebCore;
30 * SECTION:webkitgeolocationpolicydecision
31 * @short_description: Liaison between WebKit and the application regarding asynchronous geolocation policy decisions
33 * #WebKitGeolocationPolicyDecision objects are given to the application when
34 * geolocation-policy-decision-requested signal is emitted. The application
35 * uses it to tell the engine whether it wants to allow or deny geolocation for
39 G_DEFINE_TYPE(WebKitGeolocationPolicyDecision, webkit_geolocation_policy_decision, G_TYPE_OBJECT);
41 struct _WebKitGeolocationPolicyDecisionPrivate {
42 WebKitWebFrame* frame;
43 Geolocation* geolocation;
46 #define WEBKIT_GEOLOCATION_POLICY_DECISION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION, WebKitGeolocationPolicyDecisionPrivate))
48 static void webkit_geolocation_policy_decision_class_init(WebKitGeolocationPolicyDecisionClass* decisionClass)
50 g_type_class_add_private(decisionClass, sizeof(WebKitGeolocationPolicyDecisionPrivate));
53 static void webkit_geolocation_policy_decision_init(WebKitGeolocationPolicyDecision* decision)
55 decision->priv = WEBKIT_GEOLOCATION_POLICY_DECISION_GET_PRIVATE(decision);
58 WebKitGeolocationPolicyDecision* webkit_geolocation_policy_decision_new(WebKitWebFrame* frame, Geolocation* geolocation)
60 g_return_val_if_fail(frame, NULL);
61 WebKitGeolocationPolicyDecision* decision = WEBKIT_GEOLOCATION_POLICY_DECISION(g_object_new(WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION, NULL));
62 WebKitGeolocationPolicyDecisionPrivate* priv = decision->priv;
65 priv->geolocation = geolocation;
70 * webkit_geolocation_policy_allow
71 * @decision: a #WebKitGeolocationPolicyDecision
73 * Will send the allow decision to the policy implementer.
77 void webkit_geolocation_policy_allow(WebKitGeolocationPolicyDecision* decision)
79 g_return_if_fail(WEBKIT_IS_GEOLOCATION_POLICY_DECISION(decision));
81 WebKitGeolocationPolicyDecisionPrivate* priv = decision->priv;
82 priv->geolocation->setIsAllowed(TRUE);
86 * webkit_geolocation_policy_deny
87 * @decision: a #WebKitGeolocationPolicyDecision
89 * Will send the deny decision to the policy implementer.
93 void webkit_geolocation_policy_deny(WebKitGeolocationPolicyDecision* decision)
95 g_return_if_fail(WEBKIT_IS_GEOLOCATION_POLICY_DECISION(decision));
97 WebKitGeolocationPolicyDecisionPrivate* priv = decision->priv;
98 priv->geolocation->setIsAllowed(FALSE);