summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-07 11:22:47 +0100
commitcfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch)
tree24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
parent69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff)
downloadqtwebkit-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/WebKitDownload.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp28
1 files changed, 27 insertions, 1 deletions
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<WebKitURIRequest> request;
GRefPtr<WebKitURIResponse> 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<void**>(&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<void**>(&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;
+}