Reviewed by Gustavo Noronha Silva.
[Gtk] implements ChromeClient::requestGeolocationPermissionForFrame
https://bugs.webkit.org/show_bug.cgi?id=35210
* GNUmakefile.am:
2010-03-02 Arno Renevier <arno@renevier.net>
Reviewed by Gustavo Noronha Silva.
[Gtk] implements ChromeClient::requestGeolocationPermissionForFrame
https://bugs.webkit.org/show_bug.cgi?id=35210
* platform/gtk/Skipped:
2010-03-02 Arno Renevier <arno@renevier.net>
Reviewed by Gustavo Noronha Silva.
[Gtk] implements ChromeClient::requestGeolocationPermissionForFrame
https://bugs.webkit.org/show_bug.cgi?id=35210
* WebCoreSupport/ChromeClientGtk.cpp:
* WebCoreSupport/ChromeClientGtk.h:
* docs/webkitgtk-sections.txt:
* webkit/webkit.h:
* webkit/webkitdefines.h:
* webkit/webkitgeolocationpolicydecision.cpp: Added.
(webkit_geolocation_policy_decision_class_init):
(webkit_geolocation_policy_decision_init):
(webkit_geolocation_policy_decision_new):
(webkit_geolocation_policy_allow):
(webkit_geolocation_policy_deny):
* webkit/webkitgeolocationpolicydecision.h: Added.
* webkit/webkitprivate.h:
* webkit/webkitwebview.cpp:
(DNDContentsRequest::webkit_web_view_class_init):
* webkitmarshal.list:
2010-03-02 Arno Renevier <arno@renevier.net>
Reviewed by Gustavo Noronha Silva.
[Gtk] implements ChromeClient::requestGeolocationPermissionForFrame
https://bugs.webkit.org/show_bug.cgi?id=35210
* DumpRenderTree/gtk/DumpRenderTree.cpp:
(geolocationPolicyDecisionRequested):
(createWebView):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55444
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2010-03-02 Arno Renevier <arno@renevier.net>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [Gtk] implements ChromeClient::requestGeolocationPermissionForFrame
+ https://bugs.webkit.org/show_bug.cgi?id=35210
+
+ * GNUmakefile.am:
+
2010-03-02 Dmitry Titov <dimich@chromium.org>
Reviewed by Alexey Proskuryakov.
$(srcdir)/WebKit/gtk/webkit/webkitwebinspector.h \
$(srcdir)/WebKit/gtk/webkit/webkitwebnavigationaction.h \
$(srcdir)/WebKit/gtk/webkit/webkitwebpolicydecision.h \
+ $(srcdir)/WebKit/gtk/webkit/webkitgeolocationpolicydecision.h \
$(srcdir)/WebKit/gtk/webkit/webkitwebresource.h \
$(srcdir)/WebKit/gtk/webkit/webkitwebsettings.h \
$(srcdir)/WebKit/gtk/webkit/webkitwebwindowfeatures.h \
WebKit/gtk/webkit/webkitwebinspector.cpp \
WebKit/gtk/webkit/webkitwebnavigationaction.cpp \
WebKit/gtk/webkit/webkitwebpolicydecision.cpp \
+ WebKit/gtk/webkit/webkitgeolocationpolicydecision.cpp \
WebKit/gtk/webkit/webkitwebresource.cpp \
WebKit/gtk/webkit/webkitwebdatabase.cpp \
WebKit/gtk/webkit/webkitsecurityorigin.cpp \
+2010-03-02 Arno Renevier <arno@renevier.net>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [Gtk] implements ChromeClient::requestGeolocationPermissionForFrame
+ https://bugs.webkit.org/show_bug.cgi?id=35210
+
+ * platform/gtk/Skipped:
+
2010-03-02 Andy Estes <aestes@apple.com>
Reviewed by Maciej Stachowiak.
fast/dom/Geolocation/callback-exception.html
fast/dom/Geolocation/error.html
fast/dom/Geolocation/permission-denied-already-clear-watch.html
-fast/dom/Geolocation/permission-denied-already-error.html
-fast/dom/Geolocation/permission-denied-already-success.html
-fast/dom/Geolocation/permission-denied-stops-watches.html
-fast/dom/Geolocation/permission-denied.html
fast/dom/Geolocation/position-string.html
fast/dom/Geolocation/reentrant-error.html
fast/dom/Geolocation/reentrant-success.html
fast/dom/Geolocation/success.html
fast/dom/Geolocation/timeout-clear-watch.html
-fast/dom/Geolocation/timeout-zero.html
fast/dom/Geolocation/timeout.html
fast/dom/Geolocation/watch.html
fast/dom/Element/getBoundingClientRect.html
+2010-03-02 Arno Renevier <arno@renevier.net>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [Gtk] implements ChromeClient::requestGeolocationPermissionForFrame
+ https://bugs.webkit.org/show_bug.cgi?id=35210
+
+ * WebCoreSupport/ChromeClientGtk.cpp:
+ * WebCoreSupport/ChromeClientGtk.h:
+ * docs/webkitgtk-sections.txt:
+ * webkit/webkit.h:
+ * webkit/webkitdefines.h:
+ * webkit/webkitgeolocationpolicydecision.cpp: Added.
+ (webkit_geolocation_policy_decision_class_init):
+ (webkit_geolocation_policy_decision_init):
+ (webkit_geolocation_policy_decision_new):
+ (webkit_geolocation_policy_allow):
+ (webkit_geolocation_policy_deny):
+ * webkit/webkitgeolocationpolicydecision.h: Added.
+ * webkit/webkitprivate.h:
+ * webkit/webkitwebview.cpp:
+ (DNDContentsRequest::webkit_web_view_class_init):
+ * webkitmarshal.list:
+
2010-03-01 José Millán Soto <jmillan@igalia.com>
Reviewed by Gustavo Noronha Silva.
#include "CString.h"
#include "HitTestResult.h"
#include "KURL.h"
+#include "webkitgeolocationpolicydecision.h"
#include "webkitwebview.h"
#include "webkitnetworkrequest.h"
#include "webkitprivate.h"
return false;
}
-void ChromeClient::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
+void ChromeClient::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
{
- // See the comment in WebCore/page/ChromeClient.h
- notImplemented();
+ WebKitWebFrame* webFrame = kit(frame);
+ WebKitWebView* webView = getViewFromFrame(webFrame);
+
+ WebKitGeolocationPolicyDecision* policyDecision = webkit_geolocation_policy_decision_new(webFrame, geolocation);
+
+ gboolean isHandled = FALSE;
+ g_signal_emit_by_name(webView, "geolocation-policy-decision-requested", webFrame, policyDecision, &isHandled);
+ if (!isHandled)
+ webkit_geolocation_policy_deny(policyDecision);
+}
+
+void ChromeClient::cancelGeolocationPermissionRequestForFrame(WebCore::Frame* frame)
+{
+ WebKitWebFrame* webFrame = kit(frame);
+ WebKitWebView* webView = getViewFromFrame(webFrame);
+ g_signal_emit_by_name(webView, "geolocation-policy-decision-cancelled", webFrame);
}
}
virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const {}
virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
- virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*) { }
+ virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*);
private:
WebKitWebView* m_webView;
<xi:include href="xml/webkitwebhistoryitem.xml"/>
<xi:include href="xml/webkitwebnavigationaction.xml"/>
<xi:include href="xml/webkitwebpolicydecision.xml"/>
+ <xi:include href="xml/webkitgeolocationpolicydecision.xml"/>
<xi:include href="xml/webkitnetworkrequest.xml"/>
<xi:include href="xml/webkitnetworkresponse.xml"/>
<xi:include href="xml/webkitwebinspector.xml"/>
WebKitWebPolicyDecisionPrivate
</SECTION>
+<SECTION>
+<FILE>webkitgeolocationpolicydecision</FILE>
+<TITLE>WebKitGeolocationPolicyDecision</TITLE>
+WebKitGeolocationPolicyDecision
+webkit_geolocation_policy_allow
+webkit_geolocation_policy_deny
+<SUBSECTION Standard>
+WEBKIT_IS_GEOLOCATION_POLICY_DECISION
+WEBKIT_IS_GEOLOCATION_POLICY_DECISION_CLASS
+WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION
+WEBKIT_GEOLOCATION_POLICY_DECISION
+WEBKIT_GEOLOCATION_POLICY_DECISION_CLASS
+WEBKIT_GEOLOCATION_POLICY_DECISION_GET_CLASS
+<SUBSECTION Private>
+WebKitGeolocationPolicyDecision
+WebKitGeolocationPolicyDecisionClass
+WebKitGeolocationPolicyDecisionPrivate
+</SECTION>
+
<SECTION>
<FILE>webkitnetworkrequest</FILE>
<TITLE>WebKitNetworkRequest</TITLE>
#include <webkit/webkitversion.h>
#include <webkit/webkitdefines.h>
#include <webkit/webkitdownload.h>
+#include <webkit/webkitgeolocationpolicydecision.h>
#include <webkit/webkithittestresult.h>
#include <webkit/webkitnetworkrequest.h>
#include <webkit/webkitnetworkresponse.h>
typedef struct _WebKitHitTestResult WebKitHitTestResult;
typedef struct _WebKitHitTestResultClass WebKitHitTestResultClass;
+typedef struct _WebKitGeolocationPolicyDecision WebKitGeolocationPolicyDecision;
+typedef struct _WebKitGeolocationPolicyDecisionClass WebKitGeolocationPolicyDecisionClass;
+
G_END_DECLS
#endif
--- /dev/null
+/*
+ * Copyright (C) 2010 Arno Renevier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "webkitgeolocationpolicydecision.h"
+
+#include "webkitprivate.h"
+#include "Geolocation.h"
+
+using namespace WebKit;
+using namespace WebCore;
+
+/**
+ * SECTION:webkitgeolocationpolicydecision
+ * @short_description: Liaison between WebKit and the application regarding asynchronous geolocation policy decisions
+ *
+ * #WebKitGeolocationPolicyDecision objects are given to the application when
+ * geolocation-policy-decision-requested signal is emitted. The application
+ * uses it to tell the engine whether it wants to allow or deny geolocation for
+ * a given frame.
+ */
+
+G_DEFINE_TYPE(WebKitGeolocationPolicyDecision, webkit_geolocation_policy_decision, G_TYPE_OBJECT);
+
+struct _WebKitGeolocationPolicyDecisionPrivate {
+ WebKitWebFrame* frame;
+ Geolocation* geolocation;
+};
+
+#define WEBKIT_GEOLOCATION_POLICY_DECISION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION, WebKitGeolocationPolicyDecisionPrivate))
+
+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 = WEBKIT_GEOLOCATION_POLICY_DECISION_GET_PRIVATE(decision);
+}
+
+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;
+}
+
+/**
+ * webkit_geolocation_policy_allow
+ * @decision: a #WebKitGeolocationPolicyDecision
+ *
+ * Will send the allow decision to the policy implementer.
+ *
+ * Since: 1.1.23
+ */
+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);
+}
+
+/**
+ * webkit_geolocation_policy_deny
+ * @decision: a #WebKitGeolocationPolicyDecision
+ *
+ * Will send the deny decision to the policy implementer.
+ *
+ * Since: 1.1.23
+ */
+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);
+}
+
--- /dev/null
+/*
+ * Copyright (C) 2010 Arno Renevier
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef webkitgeolocationpolicydecision_h
+#define webkitgeolocationpolicydecision_h
+
+#include <glib-object.h>
+#include <webkit/webkitdefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION (webkit_geolocation_policy_decision_get_type())
+#define WEBKIT_GEOLOCATION_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION, WebKitGeolocationPolicyDecision))
+#define WEBKIT_GEOLOCATION_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION, WebKitGeolocationPolicyDecisionClass))
+#define WEBKIT_IS_GEOLOCATION_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION))
+#define WEBKIT_IS_GEOLOCATION_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION))
+#define WEBKIT_GEOLOCATION_POLICY_DECISION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION, WebKitGeolocationPolicyDecisionClass))
+
+typedef struct _WebKitGeolocationPolicyDecisionPrivate WebKitGeolocationPolicyDecisionPrivate;
+struct _WebKitGeolocationPolicyDecision {
+ GObject parent_instance;
+
+ /*< private >*/
+ WebKitGeolocationPolicyDecisionPrivate* priv;
+};
+
+struct _WebKitGeolocationPolicyDecisionClass {
+ GObjectClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_webkit_reserved0) (void);
+ void (*_webkit_reserved1) (void);
+ void (*_webkit_reserved2) (void);
+ void (*_webkit_reserved3) (void);
+};
+
+WEBKIT_API GType
+webkit_geolocation_policy_decision_get_type (void);
+
+WEBKIT_API void
+webkit_geolocation_policy_allow (WebKitGeolocationPolicyDecision* decision);
+
+WEBKIT_API void
+webkit_geolocation_policy_deny (WebKitGeolocationPolicyDecision* decision);
+
+G_END_DECLS
+
+#endif
#include "CString.h"
#include <enchant.h>
#include "GOwnPtr.h"
+#include "Geolocation.h"
#include "HistoryItem.h"
#include "Settings.h"
#include "Page.h"
WebKitNetworkResponse*
webkit_network_response_new_with_core_response(const WebCore::ResourceResponse& resourceResponse);
+ WebKitGeolocationPolicyDecision*
+ webkit_geolocation_policy_decision_new(WebKitWebFrame*, WebCore::Geolocation*);
+
// FIXME: move this to webkitnetworkrequest.h once the API is agreed upon.
WEBKIT_API SoupMessage*
webkit_network_request_get_message(WebKitNetworkRequest* request);
#include "webkitdownload.h"
#include "webkitenumtypes.h"
+#include "webkitgeolocationpolicydecision.h"
#include "webkitmarshal.h"
#include "webkitnetworkrequest.h"
#include "webkitnetworkresponse.h"
DATABASE_QUOTA_EXCEEDED,
RESOURCE_REQUEST_STARTING,
DOCUMENT_LOAD_FINISHED,
+ GEOLOCATION_POLICY_DECISION_REQUESTED,
+ GEOLOCATION_POLICY_DECISION_CANCELLED,
LAST_SIGNAL
};
WEBKIT_TYPE_NETWORK_REQUEST,
WEBKIT_TYPE_NETWORK_RESPONSE);
+ /**
+ * WebKitWebView::geolocation-policy-decision-requested:
+ * @web_view: the object on which the signal is emitted
+ * @frame: the frame that requests permission
+ * @policy_decision: a WebKitGeolocationPolicyDecision
+ *
+ * When a @frame wants to get its geolocation permission.
+ * The receiver must reply with a boolean wether it handled or not the
+ * request. If the request is not handled, default behaviour is to deny
+ * geolocation.
+ *
+ * Since: 1.1.23
+ */
+ webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_REQUESTED] = g_signal_new("geolocation-policy-decision-requested",
+ G_TYPE_FROM_CLASS(webViewClass),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST),
+ 0,
+ NULL, NULL,
+ webkit_marshal_BOOLEAN__OBJECT_OBJECT,
+ G_TYPE_BOOLEAN, 2,
+ WEBKIT_TYPE_WEB_FRAME,
+ WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION);
+
+ /**
+ * WebKitWebView::geolocation-policy-decision-cancelled:
+ * @web_view: the object on which the signal is emitted
+ * @frame: the frame that cancels geolocation request.
+ *
+ * When a @frame wants to cancel geolocation permission it had requested
+ * before.
+ *
+ * Since: 1.1.23
+ */
+ webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_REQUESTED] = g_signal_new("geolocation-policy-decision-cancelled",
+ G_TYPE_FROM_CLASS(webViewClass),
+ (GSignalFlags)(G_SIGNAL_RUN_LAST),
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ WEBKIT_TYPE_WEB_FRAME);
+
/*
* DOM-related signals. These signals are experimental, for now,
* and may change API and ABI. Their comments lack one * on
BOOLEAN:ENUM,INT
BOOLEAN:INT,INT,STRING
BOOLEAN:OBJECT
+BOOLEAN:OBJECT,OBJECT
BOOLEAN:OBJECT,OBJECT,OBJECT,OBJECT
BOOLEAN:OBJECT,OBJECT,STRING,OBJECT
BOOLEAN:OBJECT,STRING
+2010-03-02 Arno Renevier <arno@renevier.net>
+
+ Reviewed by Gustavo Noronha Silva.
+
+ [Gtk] implements ChromeClient::requestGeolocationPermissionForFrame
+ https://bugs.webkit.org/show_bug.cgi?id=35210
+
+ * DumpRenderTree/gtk/DumpRenderTree.cpp:
+ (geolocationPolicyDecisionRequested):
+ (createWebView):
+
2010-03-02 Dirk Pranke <dpranke@chromium.org>
Reviewed by David Levin.
webkit_security_origin_set_web_database_quota(origin, 5 * 1024 * 1024);
}
+static bool
+geolocationPolicyDecisionRequested(WebKitWebView*, WebKitWebFrame*, WebKitGeolocationPolicyDecision* decision)
+{
+ if (!gLayoutTestController->isGeolocationPermissionSet())
+ return FALSE;
+ if (gLayoutTestController->geolocationPermission())
+ webkit_geolocation_policy_allow(decision);
+ else
+ webkit_geolocation_policy_deny(decision);
+
+ return TRUE;
+}
+
static WebKitWebView* webViewCreate(WebKitWebView*, WebKitWebFrame*);
"signal::close-web-view", webViewClose, 0,
"signal::database-quota-exceeded", databaseQuotaExceeded, 0,
"signal::document-load-finished", webViewDocumentLoadFinished, 0,
+ "signal::geolocation-policy-decision-requested", geolocationPolicyDecisionRequested, 0,
NULL);
WebKitWebInspector* inspector = webkit_web_view_get_inspector(view);