This will be useful for implementing things like geolocation or fullscreen permission requests
Created attachment 137309 [details] Patch Proposal
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
Comment on attachment 137309 [details] Patch Proposal Attachment 137309 [details] did not pass gtk-ews (gtk): Output: http://queues.webkit.org/results/12416004
Created attachment 137312 [details] Patch Proposal
Comment on attachment 137312 [details] Patch Proposal View in context: https://bugs.webkit.org/attachment.cgi?id=137312&action=review Looks good. > Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:29 > + * There are situations where a web browser would need to ask the user Not all embedders are web browsers > Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:33 > + * #WebKitWebVice::permission-request signal with a WebKitWebVice? :-P > 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. > 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.
Created attachment 138114 [details] Patch Proposal 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 > Fixed. > > 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. Fixed. > > 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 > Fixed. > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:661 > > + * > > A code snippet here would help to understand how to use this signal > Fixed. > > 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. Fixed.
Comment on attachment 138114 [details] Patch Proposal 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. > Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:30 > + * 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" > Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:31 > + * full screen mode or reporting the user's location through the Nit: you use "full screen" here but "fullscreen" below. > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:198 > +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. > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:655 > + * 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." > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:658 > + * 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>