RESOLVED FIXED 99836
[GTK] Add API to get the WebKitWebView associated to a WebKitDownload to WebKit2 GTK+
https://bugs.webkit.org/show_bug.cgi?id=99836
Summary [GTK] Add API to get the WebKitWebView associated to a WebKitDownload to WebK...
Carlos Garcia Campos
Reported 2012-10-19 06:45:54 PDT
In WebKit2 all downloads are started by the web context, when a download has been started by the policy checker or context menu action it has a web view associated, but it's not currently possible to get it.
Attachments
Patch (27.54 KB, patch)
2012-10-19 06:56 PDT, Carlos Garcia Campos
mrobinson: review+
Carlos Garcia Campos
Comment 1 2012-10-19 06:56:08 PDT
WebKit Review Bot
Comment 2 2012-10-19 06:58:42 PDT
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
Martin Robinson
Comment 3 2012-10-19 08:38:58 PDT
Comment on attachment 169614 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169614&action=review > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:2780 > +WebKitDownload* webkit_web_view_download_uri(WebKitWebView* webView, const char* uri) Why is it useful to start a download with with a WebView?
Carlos Garcia Campos
Comment 4 2012-10-20 01:37:14 PDT
(In reply to comment #3) > (From update of attachment 169614 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=169614&action=review > > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:2780 > > +WebKitDownload* webkit_web_view_download_uri(WebKitWebView* webView, const char* uri) > > Why is it useful to start a download with with a WebView? To use the web view as the initiating page of the download. This allow you to show the downloasd in the right window, for example in the application. Imagine you are implementing your own custom context menu, for example, you want to start the download associated to the web view that showed the context menu. Note that WebContext::download() takes a initiating web page as first argument, but we are always passing NULL in this moment. We could have webkit_web_context_download_uri_for_web_view() to pass an initiating page to download() but I think it's more natural to have the method in the web view instead.
Martin Robinson
Comment 5 2012-10-23 18:29:04 PDT
Comment on attachment 169614 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=169614&action=review > Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp:295 > + * start a download from a particular #WebKitWebView use Nit: start -> starting > Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp:993 > +void webkitWebViewBaseSetDownloadRequestHandler(WebKitWebViewBase* webViewBase, WebKitWebViewBaseDownloadRequestHandler downloadHandler) > +{ > + webViewBase->priv->downloadHandler = downloadHandler; > +} > + > +void webkitWebViewBaseHandleDownloadRequest(WebKitWebViewBase* webViewBase, DownloadProxy* download) > +{ > + if (webViewBase->priv->downloadHandler) > + webViewBase->priv->downloadHandler(webViewBase, download); > +} I guess this is to avoid exposing any API in the base class. I think we should think seriously about just getting rid of WebKitWebViewBase before the stable release.
Carlos Garcia Campos
Comment 6 2012-10-24 00:40:46 PDT
Note You need to log in before you can comment on or make changes to this bug.