You need to
before you can comment on or make changes to this bug.
This will be useful for implementing things like geolocation or fullscreen permission requests
Created an attachment (id=137309) [details]
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
(From update of attachment 137309 [details])
Attachment 137309 [details] did not pass gtk-ews (gtk):
Created an attachment (id=137312) [details]
(From update of attachment 137312 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=137312&action=review
> + * There are situations where a web browser would need to ask the user
Not all embedders are web browsers
> + * #WebKitWebVice::permission-request signal with a
> + * 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.
This depends on the implementation, or it should be enforced by the interface.
> + *
You should mention here that if this signal is not hanlded, the default behaviour is to deny the request
> + *
A code snippet here would help to understand how to use this signal
> + gboolean (* permission_request) (WebKitWebView *web_view,
> + WebKitPermissionRequest *permission_request);
There's an extra space before parameter names.
Created an attachment (id=138114) [details]
Thanks for the review. Attached new patch addressing all the issues.
See some comments below...
(In reply to comment #5)
> Not all embedders are web browsers
> > Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:33
> > + * #WebKitWebVice::permission-request signal with a
> WebKitWebVice? :-P
You have to admit it was a great name to have in the API, a bit useless though.
> > Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:40
> > + * 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.
> This depends on the implementation, or it should be enforced by the interface.
Fixed (just removed)
> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:656
> > + *
> You should mention here that if this signal is not hanlded, the default behaviour is to deny the request
> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:661
> > + *
> A code snippet here would help to understand how to use this signal
> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h:146
> > + gboolean (* permission_request) (WebKitWebView *web_view,
> > + WebKitPermissionRequest *permission_request);
> There's an extra space before parameter names.
(From update of attachment 138114 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=138114&action=review
Looks good. In the future, some requests show allow asynchronous handling. Some probably won't allow that. The documentation in WebKitWebView should explain the situation and we should add some API to make this discoverable.
> + * for permission on certain type of operations, such as switching to
"to ask the user for permission on certain type" -> "to ask the user for permission to do certain types"
> + * full screen mode or reporting the user's location through the
Nit: you use "full screen" here but "fullscreen" below.
> +static gboolean webkitWebViewPermissionRequest(WebKitWebView*, WebKitPermissionRequest* decision)
> + webkit_permission_request_deny(decision);
> + return TRUE;
Installing a default handler like this means that the request cannot be answered asynchronously. Perhaps it's better to do this in the finalize method for the concrete types.
> + * decide about a permission request, such as allowing the browser
> + * switch to fullscreen mode, sharing its location or similar.
"allowing the browser to switch to fullscreen"
"or similar" -> "or similar operations."
> + * A possible way to use this signal could be through a dialog to
> + * allow the user decide what to do with the request:
"through a dialog to allow" -> "through a dialog allowing"
Committed r118522: <http://trac.webkit.org/changeset/118522>