summaryrefslogtreecommitdiffstats
path: root/WebKit/gtk/webkit/webkitdownload.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-10-08 17:19:54 +0100
committerSteve Block <steveblock@google.com>2009-10-20 00:41:58 +0100
commit231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch)
treea6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebKit/gtk/webkit/webkitdownload.cpp
parente196732677050bd463301566a68a643b6d14b907 (diff)
downloadexternal_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz
external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebKit/gtk/webkit/webkitdownload.cpp')
-rw-r--r--WebKit/gtk/webkit/webkitdownload.cpp36
1 files changed, 33 insertions, 3 deletions
diff --git a/WebKit/gtk/webkit/webkitdownload.cpp b/WebKit/gtk/webkit/webkitdownload.cpp
index c0c6ea7..568378c 100644
--- a/WebKit/gtk/webkit/webkitdownload.cpp
+++ b/WebKit/gtk/webkit/webkitdownload.cpp
@@ -25,6 +25,7 @@
#include "Noncopyable.h"
#include "NotImplemented.h"
#include "ResourceHandleClient.h"
+#include "ResourceHandleInternal.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "webkitdownload.h"
@@ -100,6 +101,7 @@ enum {
G_DEFINE_TYPE(WebKitDownload, webkit_download, G_TYPE_OBJECT);
+static void webkit_download_set_response(WebKitDownload* download, const ResourceResponse& response);
static void webkit_download_set_status(WebKitDownload* download, WebKitDownloadStatus status);
static void webkit_download_dispose(GObject* object)
@@ -373,6 +375,25 @@ WebKitDownload* webkit_download_new(WebKitNetworkRequest* request)
return WEBKIT_DOWNLOAD(g_object_new(WEBKIT_TYPE_DOWNLOAD, "network-request", request, NULL));
}
+// Internal usage only
+WebKitDownload* webkit_download_new_with_handle(WebKitNetworkRequest* request, WebCore::ResourceHandle* handle, const WebCore::ResourceResponse& response)
+{
+ g_return_val_if_fail(request, NULL);
+
+ ResourceHandleInternal* d = handle->getInternal();
+ soup_session_pause_message(webkit_get_default_session(), d->m_msg);
+
+ WebKitDownload* download = WEBKIT_DOWNLOAD(g_object_new(WEBKIT_TYPE_DOWNLOAD, "network-request", request, NULL));
+ WebKitDownloadPrivate* priv = download->priv;
+
+ handle->ref();
+ priv->resourceHandle = handle;
+
+ webkit_download_set_response(download, response);
+
+ return download;
+}
+
static gboolean webkit_download_open_stream_for_uri(WebKitDownload* download, const gchar* uri, gboolean append=FALSE)
{
g_return_val_if_fail(uri, FALSE);
@@ -425,10 +446,14 @@ void webkit_download_start(WebKitDownload* download)
g_return_if_fail(priv->status == WEBKIT_DOWNLOAD_STATUS_CREATED);
g_return_if_fail(priv->timer == NULL);
- if (priv->resourceHandle)
- priv->resourceHandle->setClient(priv->downloadClient);
- else
+ if (!priv->resourceHandle)
priv->resourceHandle = ResourceHandle::create(core(priv->networkRequest), priv->downloadClient, 0, false, false, false);
+ else {
+ priv->resourceHandle->setClient(priv->downloadClient);
+
+ ResourceHandleInternal* d = priv->resourceHandle->getInternal();
+ soup_session_unpause_message(webkit_get_default_session(), d->m_msg);
+ }
priv->timer = g_timer_new();
webkit_download_open_stream_for_uri(download, priv->destinationURI);
@@ -510,6 +535,9 @@ static void webkit_download_set_response(WebKitDownload* download, const Resourc
// FIXME Use WebKitNetworkResponse when it's merged.
WebKitDownloadPrivate* priv = download->priv;
priv->networkResponse = new ResourceResponse(response);
+
+ if (!response.isNull() && !response.suggestedFilename().isEmpty())
+ webkit_download_set_suggested_filename(download, response.suggestedFilename().utf8().data());
}
/**
@@ -544,6 +572,8 @@ void webkit_download_set_suggested_filename(WebKitDownload* download, const gcha
WebKitDownloadPrivate* priv = download->priv;
g_free(priv->suggestedFilename);
priv->suggestedFilename = g_strdup(suggestedFilename);
+
+ g_object_notify(G_OBJECT(download), "suggested-filename");
}