diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp index 245f1a61b..e9524c209 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp @@ -34,6 +34,19 @@ using namespace WebKit; using namespace WebCore; +/** + * SECTION: WebKitDownload + * @Short_description: Object used to communicate with the application when downloading + * @Title: WebKitDownload + * + * #WebKitDownload carries information about a download request and + * response, including a #WebKitURIRequest and a #WebKitURIResponse + * objects. The application may use this object to control the + * download process, or to simply figure out what is to be downloaded, + * and handle the download process itself. + * + */ + enum { RECEIVED_DATA, FINISHED, @@ -101,7 +114,12 @@ static gboolean webkitDownloadDecideDestination(WebKitDownload* download, const return FALSE; GOwnPtr<char> filename(g_strdelimit(g_strdup(suggestedFilename), G_DIR_SEPARATOR_S, '_')); - GOwnPtr<char> destination(g_build_filename(g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD), filename.get(), NULL)); + const gchar *downloadsDir = g_get_user_special_dir(G_USER_DIRECTORY_DOWNLOAD); + if (!downloadsDir) { + // If we don't have XDG user dirs info, set just to HOME. + downloadsDir = g_get_home_dir(); + } + GOwnPtr<char> destination(g_build_filename(downloadsDir, filename.get(), NULL)); GOwnPtr<char> destinationURI(g_filename_to_uri(destination.get(), 0, 0)); download->priv->destinationURI = destinationURI.get(); g_object_notify(G_OBJECT(download), "destination"); @@ -263,6 +281,13 @@ WebKitDownload* webkitDownloadCreate(DownloadProxy* downloadProxy) return download; } +WebKitDownload* webkitDownloadCreateForRequest(DownloadProxy* downloadProxy, const ResourceRequest& request) +{ + WebKitDownload* download = webkitDownloadCreate(downloadProxy); + download->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(request)); + return download; +} + void webkitDownloadSetResponse(WebKitDownload* download, WebKitURIResponse* response) { download->priv->response = response; |