From cfd86b747d32ac22246a1aa908eaa720c63a88c1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 7 Nov 2012 11:22:47 +0100 Subject: Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733) New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes. --- Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp') diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index de0f28dce..506f11a55 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -28,6 +28,7 @@ #include "WebKitContextMenuClient.h" #include "WebKitContextMenuItemPrivate.h" #include "WebKitContextMenuPrivate.h" +#include "WebKitDownloadPrivate.h" #include "WebKitEnumTypes.h" #include "WebKitError.h" #include "WebKitFaviconDatabasePrivate.h" @@ -390,6 +391,12 @@ static gboolean webkitWebViewRunFileChooser(WebKitWebView* webView, WebKitFileCh return TRUE; } +static void webkitWebViewHandleDownloadRequest(WebKitWebViewBase* webViewBase, DownloadProxy* downloadProxy) +{ + GRefPtr download = webkitWebContextGetOrCreateDownload(downloadProxy); + webkitDownloadSetWebView(download.get(), WEBKIT_WEB_VIEW(webViewBase)); +} + static void webkitWebViewConstructed(GObject* object) { if (G_OBJECT_CLASS(webkit_web_view_parent_class)->constructed) @@ -400,6 +407,7 @@ static void webkitWebViewConstructed(GObject* object) WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(webView); webkitWebViewBaseCreateWebPage(webViewBase, webkitWebContextGetContext(priv->context), 0); + webkitWebViewBaseSetDownloadRequestHandler(webViewBase, webkitWebViewHandleDownloadRequest); attachLoaderClientToView(webView); attachUIClientToView(webView); @@ -2758,3 +2766,24 @@ gboolean webkit_web_view_save_to_file_finish(WebKitWebView* webView, GAsyncResul return TRUE; } + +/** + * webkit_web_view_download_uri: + * @web_view: a #WebKitWebView + * @uri: the URI to download + * + * Requests downloading of the specified URI string for @web_view. + * + * Returns: (transfer full): a new #WebKitDownload representing the + * the download operation. + */ +WebKitDownload* webkit_web_view_download_uri(WebKitWebView* webView, const char* uri) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); + g_return_val_if_fail(uri, 0); + + WebKitDownload* download = webkitWebContextStartDownload(webView->priv->context, uri, getPage(webView)); + webkitDownloadSetWebView(download, webView); + + return download; +} -- cgit v1.2.1