[webkit-gtk] Implement runOpenPanel in WebKit2GTK+

Martin Robinson mrobinson at webkit.org
Fri Feb 10 17:56:33 PST 2012


On Fri, Feb 10, 2012 at 3:10 PM, Mario Sanchez Prada
<msanchez at igalia.com> wrote:
> I started yesterday working on an implementation for WebKitUIClient's
> runOpenPanel() in WebKit2GTK+, and would like to share here the ideas
> behind it and the current status of it (aka the patch I have so far).
>
> What I did so far is basically the following:
>
> - Implement runOpenPanel() in WebKitUIClient.cpp, where I create
>  an object of a new class wrapping WKOpenPanelResultListenerRef and
>  WKOpenPanelParametersRef, which I named WebKitOpenPanelDecision atm.
>
> - The API for that new WebKitOpenPanelDecision is simple: it provides a
>  allows_multiple_files(), choose_files() and cancel() methods,
>  implemented in terms of the wrapped WKOpenPanelResultListenerRef and
>  WKOpenPanelParametersRef attributes.
>
> - Once that object is created, pass it to the webView to emit a new
>  signal from there, including that new object as parameter. At the
>  moment, I named that new signal 'decide-open-panel', inspired in the
>  'decide-policy' signal. It uses g_signal_accumulator_true_handled.

The API seems great to me, though I quibble with the names a little.
:) I don't think the policy decision is a great model here. Perhaps
WebKitWebView::run-file-chooser and WebKitFileChooserRequest or
something similar "Open panel" is a term from OS X, I think.

--Martin


More information about the webkit-gtk mailing list