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. --- .../WebKit2/UIProcess/API/gtk/WebKitDownload.cpp | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp') diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp index cc3b51f52..a6754de06 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp @@ -57,6 +57,7 @@ struct _WebKitDownloadPrivate { GRefPtr request; GRefPtr response; + WebKitWebView* webView; CString destinationURI; guint64 currentSize; bool isCancelled; @@ -71,7 +72,10 @@ G_DEFINE_TYPE(WebKitDownload, webkit_download, G_TYPE_OBJECT) static void webkitDownloadFinalize(GObject* object) { - WEBKIT_DOWNLOAD(object)->priv->~WebKitDownloadPrivate(); + WebKitDownloadPrivate* priv = WEBKIT_DOWNLOAD(object)->priv; + if (priv->webView) + g_object_remove_weak_pointer(G_OBJECT(priv->webView), reinterpret_cast(&priv->webView)); + priv->~WebKitDownloadPrivate(); G_OBJECT_CLASS(webkit_download_parent_class)->finalize(object); } @@ -278,6 +282,12 @@ void webkitDownloadSetResponse(WebKitDownload* download, WebKitURIResponse* resp g_object_notify(G_OBJECT(download), "response"); } +void webkitDownloadSetWebView(WebKitDownload* download, WebKitWebView* webView) +{ + download->priv->webView = webView; + g_object_add_weak_pointer(G_OBJECT(webView), reinterpret_cast(&download->priv->webView)); +} + bool webkitDownloadIsCancelled(WebKitDownload* download) { return download->priv->isCancelled; @@ -530,3 +540,19 @@ guint64 webkit_download_get_received_data_length(WebKitDownload* download) return download->priv->currentSize; } + +/** + * webkit_download_get_web_view: + * @download: a #WebKitDownload + * + * Get the #WebKitWebView that initiated the download. + * + * Returns: (transfer none): the #WebKitWebView that initiated @download, + * or %NULL if @download was not initiated by a #WebKitWebView. + */ +WebKitWebView* webkit_download_get_web_view(WebKitDownload* download) +{ + g_return_val_if_fail(WEBKIT_IS_DOWNLOAD(download), 0); + + return download->priv->webView; +} -- cgit v1.2.1