summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter.cpp
diff options
context:
space:
mode:
authorAdam Kallai <kadam@inf.u-szeged.hu>2016-03-30 13:25:19 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2016-06-22 08:28:53 +0000
commit637f34d38b97cbfd5faf407756b32986a2607543 (patch)
treef69616c1983bcf1c3e569b6dd483ccf18ed2d767 /src/core/web_contents_adapter.cpp
parent349e96d833493faaba2cd879e31811f07507cc37 (diff)
Add a DownloadType enum property to WebEngineDownloadItem
With this property the user gets the requested download's type. In other words, the user can identify the download where it comes from based on the type. Update public API list as well. Change-Id: I2b066d7eb4df1134266ad67ade0066e3bcc2b454 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r--src/core/web_contents_adapter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index e37a3ad24..364d4d5b2 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -46,6 +46,7 @@
#include "browser_accessibility_qt.h"
#include "browser_context_adapter.h"
+#include "browser_context_adapter_client.h"
#include "browser_context_qt.h"
#include "download_manager_delegate_qt.h"
#include "media_capture_devices_dispatcher.h"
@@ -847,11 +848,17 @@ void WebContentsAdapter::updateWebPreferences(const content::WebPreferences & we
void WebContentsAdapter::download(const QUrl &url, const QString &suggestedFileName)
{
+ Q_D(WebContentsAdapter);
content::BrowserContext *bctx = webContents()->GetBrowserContext();
content::DownloadManager *dlm = content::BrowserContext::GetDownloadManager(bctx);
+ DownloadManagerDelegateQt *dlmd = d->browserContextAdapter->downloadManagerDelegate();
+
if (!dlm)
return;
+ dlmd->setDownloadType(BrowserContextAdapterClient::UserRequested);
+ dlm->SetDelegate(dlmd);
+
scoped_ptr<content::DownloadUrlParameters> params(
content::DownloadUrlParameters::FromWebContents(webContents(), toGurl(url)));
params->set_suggested_name(toString16(suggestedFileName));