diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp | |
parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz |
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.
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
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<WebKitDownload> 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; +} |