WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch Proposal
0001-2012-04-13-Mario-Sanchez-Prada-msanchez-igalia.com.patch (text/plain), 19.72 KB, created by
Mario Sanchez Prada
on 2012-04-16 03:44:39 PDT
(
hide
)
Description:
Patch Proposal
Filename:
MIME Type:
Creator:
Mario Sanchez Prada
Created:
2012-04-16 03:44:39 PDT
Size:
19.72 KB
patch
obsolete
>From c9cc67499cbaa6f486e6468b48825842450f8237 Mon Sep 17 00:00:00 2001 >From: Mario Sanchez Prada <msanchez@igalia.com> >Date: Fri, 13 Apr 2012 15:30:13 +0200 >Subject: [PATCH] 2012-04-13 Mario Sanchez Prada <msanchez@igalia.com> > > [GTK][WK2] Implement API for generic permission requests > https://bugs.webkit.org/show_bug.cgi?id=84018 > > Reviewed by NOBODY (OOPS!). > > Added new 'permission-request' signal to WebKitWebView, to be > fired when WebKit needs confirmation from the user on whether to > allow or deny certain operations, such as sharing the user's > location with web site through the Geolocation API. > > New WebKitPermissionRequest interface, providing allow() and > deny() operations, to be called over the objects implementing it > when emitted along with the new 'permission-request' signal. > > * UIProcess/API/gtk/WebKitPermissionRequest.cpp: Added. > (webkit_permission_request_default_init): > (webkit_permission_request_allow): > (webkit_permission_request_deny): > * UIProcess/API/gtk/WebKitPermissionRequest.h: Added. > (_WebKitPermissionRequestIface): > * GNUmakefile.am: Added new files. > > Added the new signal to WebKitWebView, providing a default handler > that will just deny the request when the signal is not handled. > > * UIProcess/API/gtk/WebKitWebView.cpp: > (webkitWebViewDecidePermissionRequest): Default handler. > (webkit_web_view_class_init): Declare the new signal and connect > to the default handler. > (webkitWebViewMakePermissionRequest): Helper function to create a > make a new permission request and emit the new signal signal. > * UIProcess/API/gtk/WebKitWebView.h: > (_WebKitWebViewClass): > * UIProcess/API/gtk/WebKitWebViewPrivate.h: Declare the creational > function webkitWebViewMakePermissionRequest for internal use only. > > Updated documentation files. > > * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: > * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: >--- > Source/WebKit2/ChangeLog | 43 +++++++++++ > Source/WebKit2/GNUmakefile.am | 3 + > .../UIProcess/API/gtk/WebKitPermissionRequest.cpp | 78 ++++++++++++++++++++ > .../UIProcess/API/gtk/WebKitPermissionRequest.h | 58 +++++++++++++++ > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp | 41 ++++++++++ > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h | 3 + > .../UIProcess/API/gtk/WebKitWebViewPrivate.h | 1 + > .../UIProcess/API/gtk/docs/webkit2gtk-docs.sgml | 1 + > .../UIProcess/API/gtk/docs/webkit2gtk-sections.txt | 18 +++++ > Source/WebKit2/UIProcess/API/gtk/webkit2.h | 1 + > 10 files changed, 247 insertions(+), 0 deletions(-) > create mode 100644 Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp > create mode 100644 Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h > >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index d7ecf74..d73e71b 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,5 +1,48 @@ > 2012-04-13 Mario Sanchez Prada <msanchez@igalia.com> > >+ [GTK][WK2] Implement API for generic permission requests >+ https://bugs.webkit.org/show_bug.cgi?id=84018 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added new 'permission-request' signal to WebKitWebView, to be >+ fired when WebKit needs confirmation from the user on whether to >+ allow or deny certain operations, such as sharing the user's >+ location with web site through the Geolocation API. >+ >+ New WebKitPermissionRequest interface, providing allow() and >+ deny() operations, to be called over the objects implementing it >+ when emitted along with the new 'permission-request' signal. >+ >+ * UIProcess/API/gtk/WebKitPermissionRequest.cpp: Added. >+ (webkit_permission_request_default_init): >+ (webkit_permission_request_allow): >+ (webkit_permission_request_deny): >+ * UIProcess/API/gtk/WebKitPermissionRequest.h: Added. >+ (_WebKitPermissionRequestIface): >+ * GNUmakefile.am: Added new files. >+ >+ Added the new signal to WebKitWebView, providing a default handler >+ that will just deny the request when the signal is not handled. >+ >+ * UIProcess/API/gtk/WebKitWebView.cpp: >+ (webkitWebViewDecidePermissionRequest): Default handler. >+ (webkit_web_view_class_init): Declare the new signal and connect >+ to the default handler. >+ (webkitWebViewMakePermissionRequest): Helper function to create a >+ make a new permission request and emit the new signal signal. >+ * UIProcess/API/gtk/WebKitWebView.h: >+ (_WebKitWebViewClass): >+ * UIProcess/API/gtk/WebKitWebViewPrivate.h: Declare the creational >+ function webkitWebViewMakePermissionRequest for internal use only. >+ >+ Updated documentation files. >+ >+ * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: >+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: >+ >+2012-04-13 Mario Sanchez Prada <msanchez@igalia.com> >+ > [GTK][WK2] Implement geolocation provider for the GTK port > https://bugs.webkit.org/show_bug.cgi?id=83877 > >diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am >index 6ddb858..44fbb2b 100644 >--- a/Source/WebKit2/GNUmakefile.am >+++ b/Source/WebKit2/GNUmakefile.am >@@ -95,6 +95,7 @@ libwebkit2gtkinclude_HEADERS = \ > $(WebKit2)/UIProcess/API/gtk/WebKitHitTestResult.h \ > $(WebKit2)/UIProcess/API/gtk/WebKitJavascriptResult.h \ > $(WebKit2)/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h \ >+ $(WebKit2)/UIProcess/API/gtk/WebKitPermissionRequest.h \ > $(WebKit2)/UIProcess/API/gtk/WebKitPolicyDecision.h \ > $(WebKit2)/UIProcess/API/gtk/WebKitPrintOperation.h \ > $(WebKit2)/UIProcess/API/gtk/WebKitResponsePolicyDecision.h \ >@@ -577,6 +578,8 @@ webkit2_sources += \ > Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp \ > Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h \ > Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h \ >+ Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp \ >+ Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h \ > Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.cpp \ > Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecision.h \ > Source/WebKit2/UIProcess/API/gtk/WebKitPolicyDecisionPrivate.h \ >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp >new file mode 100644 >index 0000000..b8f721f >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp >@@ -0,0 +1,78 @@ >+/* >+ * Copyright (C) 2012 Igalia S.L. >+ * >+ * 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 "WebKitPermissionRequest.h" >+ >+/** >+ * SECTION: WebKitPermissionRequest >+ * @Short_description: A permission request >+ * @Title: WebKitPermissionRequest >+ * @See_also: #WebKitWebView >+ * >+ * There are situations where a web browser would need to ask the user >+ * for permission on certain type of operations, such as switching to >+ * full screen mode or reporting the user's location through the >+ * standard Geolocation API. In those cases, WebKit will emit a >+ * #WebKitWebVice::permission-request signal with a >+ * #WebKitPermissionRequest object attached to it. >+ * >+ * If the signal handler does nothing, WebKit will act as if >+ * webkit_permission_request_deny() was called as soon as signal >+ * handling completes. To handle a permission request in an >+ * asynchronous way, simply increment the reference count of the >+ * #WebKitPermissionRequest object. >+ */ >+ >+typedef WebKitPermissionRequestIface WebKitPermissionRequestInterface; >+G_DEFINE_INTERFACE(WebKitPermissionRequest, webkit_permission_request, G_TYPE_OBJECT) >+ >+static void webkit_permission_request_default_init(WebKitPermissionRequestIface*) >+{ >+} >+ >+/** >+ * webkit_permission_request_allow: >+ * @request: a #WebKitPermissionRequest >+ * >+ * Allow the action which triggered this request. >+ */ >+void webkit_permission_request_allow(WebKitPermissionRequest* request) >+{ >+ g_return_if_fail(WEBKIT_IS_PERMISSION_REQUEST(request)); >+ >+ WebKitPermissionRequestIface* iface = WEBKIT_PERMISSION_REQUEST_GET_IFACE(request); >+ if (iface->allow) >+ iface->allow(request); >+} >+ >+/** >+ * webkit_permission_request_deny: >+ * @request: a #WebKitPermissionRequest >+ * >+ * Deny the action which triggerd this request. >+ */ >+void webkit_permission_request_deny(WebKitPermissionRequest* request) >+{ >+ g_return_if_fail(WEBKIT_IS_PERMISSION_REQUEST(request)); >+ >+ WebKitPermissionRequestIface* iface = WEBKIT_PERMISSION_REQUEST_GET_IFACE(request); >+ if (iface->deny) >+ iface->deny(request); >+} >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h >new file mode 100644 >index 0000000..a62f1f1 >--- /dev/null >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2012 Igalia S.L. >+ * >+ * 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. >+ */ >+ >+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) >+#error "Only <webkit2/webkit2.h> can be included directly." >+#endif >+ >+#ifndef WebKitPermissionRequest_h >+#define WebKitPermissionRequest_h >+ >+#include <glib-object.h> >+#include <webkit2/WebKitDefines.h> >+ >+G_BEGIN_DECLS >+ >+#define WEBKIT_TYPE_PERMISSION_REQUEST (webkit_permission_request_get_type()) >+#define WEBKIT_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_PERMISSION_REQUEST, WebKitPermissionRequest)) >+#define WEBKIT_IS_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_PERMISSION_REQUEST)) >+#define WEBKIT_PERMISSION_REQUEST_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), WEBKIT_TYPE_PERMISSION_REQUEST, WebKitPermissionRequestIface)) >+ >+typedef struct _WebKitPermissionRequest WebKitPermissionRequest; >+typedef struct _WebKitPermissionRequestIface WebKitPermissionRequestIface; >+ >+struct _WebKitPermissionRequestIface { >+ GTypeInterface parent_interface; >+ >+ void (* allow) (WebKitPermissionRequest *request); >+ void (* deny) (WebKitPermissionRequest *request); >+}; >+ >+WEBKIT_API GType >+webkit_permission_request_get_type (void); >+ >+WEBKIT_API void >+webkit_permission_request_allow (WebKitPermissionRequest *request); >+ >+WEBKIT_API void >+webkit_permission_request_deny (WebKitPermissionRequest *request); >+ >+G_END_DECLS >+ >+#endif >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp >index 7a6c01d..8a63602 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp >@@ -64,6 +64,7 @@ enum { > SCRIPT_DIALOG, > > DECIDE_POLICY, >+ PERMISSION_REQUEST, > > MOUSE_TARGET_CHANGED, > >@@ -190,6 +191,12 @@ static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* > return TRUE; > } > >+static gboolean webkitWebViewPermissionRequest(WebKitWebView*, WebKitPermissionRequest* decision) >+{ >+ webkit_permission_request_deny(decision); >+ return TRUE; >+} >+ > static void zoomTextOnlyChanged(WebKitSettings* settings, GParamSpec*, WebKitWebView* webView) > { > WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); >@@ -313,6 +320,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) > webViewClass->create = webkitWebViewCreate; > webViewClass->script_dialog = webkitWebViewScriptDialog; > webViewClass->decide_policy = webkitWebViewDecidePolicy; >+ webViewClass->permission_request = webkitWebViewPermissionRequest; > > g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate)); > >@@ -638,6 +646,33 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) > WEBKIT_TYPE_POLICY_DECISION_TYPE); > > /** >+ * WebKitWebView::permission-request: >+ * @web_view: the #WebKitWebView on which the signal is emitted >+ * @request: the #WebKitPermissionRequest >+ * >+ * This signal is emitted when WebKit is requesting the client to >+ * decide about a permission request, such as allowing the browser >+ * switch to fullscreen mode, sharing its location or similar. >+ * >+ * If the last reference is removed on a #WebKitPermissionRequest >+ * and no decision has been made, webkit_permission_request_deny() >+ * will be the default decision. The default signal handler will >+ * simply call webkit_permission_request_deny(). >+ * >+ * Returns: %TRUE to stop other handlers from being invoked for the event. >+ * %FALSE to propagate the event further. >+ * >+ */ >+ signals[PERMISSION_REQUEST] = >+ g_signal_new("permission-request", >+ G_TYPE_FROM_CLASS(webViewClass), >+ G_SIGNAL_RUN_LAST, >+ G_STRUCT_OFFSET(WebKitWebViewClass, permission_request), >+ g_signal_accumulator_true_handled, 0 /* accumulator data */, >+ webkit_marshal_BOOLEAN__OBJECT, >+ G_TYPE_BOOLEAN, 1, /* number of parameters */ >+ WEBKIT_TYPE_PERMISSION_REQUEST); >+ /** > * WebKitWebView::mouse-target-changed: > * @web_view: the #WebKitWebView on which the signal is emitted > * @hit_test_result: a #WebKitHitTestResult >@@ -891,6 +926,12 @@ void webkitWebViewMakePolicyDecision(WebKitWebView* webView, WebKitPolicyDecisio > g_signal_emit(webView, signals[DECIDE_POLICY], 0, decision, type, &returnValue); > } > >+void webkitWebViewMakePermissionRequest(WebKitWebView* webView, WebKitPermissionRequest* request) >+{ >+ gboolean returnValue; >+ g_signal_emit(webView, signals[PERMISSION_REQUEST], 0, request, &returnValue); >+} >+ > void webkitWebViewMouseTargetChanged(WebKitWebView* webView, WKHitTestResultRef wkHitTestResult, unsigned modifiers) > { > WebKitWebViewPrivate* priv = webView->priv; >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h >index f5c21c5..7adc4fa 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h >@@ -41,6 +41,7 @@ > #include <webkit2/WebKitWebResource.h> > #include <webkit2/WebKitWebViewBase.h> > #include <webkit2/WebKitWindowProperties.h> >+#include <webkit2/WebKitPermissionRequest.h> > #include <webkit2/WebKitPolicyDecision.h> > > G_BEGIN_DECLS >@@ -141,6 +142,8 @@ struct _WebKitWebViewClass { > gboolean (* decide_policy) (WebKitWebView *web_view, > WebKitPolicyDecision *decision, > WebKitPolicyDecisionType type); >+ gboolean (* permission_request) (WebKitWebView *web_view, >+ WebKitPermissionRequest *permission_request); > void (* mouse_target_changed) (WebKitWebView *web_view, > WebKitHitTestResult *hit_test_result, > guint modifiers); >diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h >index 70d6d6d..72b810a 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h >+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h >@@ -42,6 +42,7 @@ void webkitWebViewClosePage(WebKitWebView*); > void webkitWebViewRunJavaScriptAlert(WebKitWebView*, const CString& message); > bool webkitWebViewRunJavaScriptConfirm(WebKitWebView*, const CString& message); > WKStringRef webkitWebViewRunJavaScriptPrompt(WebKitWebView*, const CString& message, const CString& defaultText); >+void webkitWebViewMakePermissionRequest(WebKitWebView*, WebKitPermissionRequest*); > void webkitWebViewMakePolicyDecision(WebKitWebView*, WebKitPolicyDecisionType, WebKitPolicyDecision*); > void webkitWebViewMouseTargetChanged(WebKitWebView*, WKHitTestResultRef, unsigned modifiers); > void webkitWebViewPrintFrame(WebKitWebView*, WKFrameRef); >diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml >index 9f08663..0f918f3 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml >+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml >@@ -21,6 +21,7 @@ > <xi:include href="xml/WebKitURIResponse.xml"/> > <xi:include href="xml/WebKitWindowProperties.xml"/> > <xi:include href="xml/WebKitDownload.xml"/> >+ <xi:include href="xml/WebKitPermissionRequest.xml"/> > <xi:include href="xml/WebKitPolicyDecision.xml"/> > <xi:include href="xml/WebKitNavigationPolicyDecision.xml"/> > <xi:include href="xml/WebKitResponsePolicyDecision.xml"/> >diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt >index 829de1c..329cef5 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt >+++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt >@@ -48,6 +48,7 @@ webkit_web_context_get_type > <TITLE>WebKitWebView</TITLE> > WebKitWebView > WebKitLoadEvent >+WebKitPermissionRequestType > WebKitPolicyDecisionType > > <SUBSECTION Editing Commands> >@@ -357,6 +358,23 @@ webkit_download_get_type > </SECTION> > > <SECTION> >+<FILE>WebKitPermissionRequest</FILE> >+WebKitPermissionRequest >+webkit_permission_request_allow >+webkit_permission_request_deny >+ >+<SUBSECTION Standard> >+WebKitPermissionRequestIface >+WEBKIT_TYPE_PERMISSION_REQUEST >+WEBKIT_PERMISSION_REQUEST >+WEBKIT_IS_PERMISSION_REQUEST >+WEBKIT_PERMISSION_REQUEST_GET_IFACE >+ >+<SUBSECTION Private> >+webkit_permission_request_get_type >+</SECTION> >+ >+<SECTION> > <FILE>WebKitPolicyDecision</FILE> > WebKitPolicyDecision > webkit_policy_decision_download >diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h >index 7d3fb0a..b5d828b 100644 >--- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h >+++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h >@@ -33,6 +33,7 @@ > #include <webkit2/WebKitFindController.h> > #include <webkit2/WebKitHitTestResult.h> > #include <webkit2/WebKitJavascriptResult.h> >+#include <webkit2/WebKitPermissionRequest.h> > #include <webkit2/WebKitPrintOperation.h> > #include <webkit2/WebKitScriptDialog.h> > #include <webkit2/WebKitSettings.h> >-- >1.7.7.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
pnormand
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 84018
:
137309
|
137312
|
138114