summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTamas Zakor <ztamas@inf.u-szeged.hu>2019-02-12 15:41:41 +0100
committerZakor Tamas <ztamas@inf.u-szeged.hu>2019-02-14 12:22:41 +0000
commit7f11221749e835a12d27156a17a0fa2b13c19cc2 (patch)
treef04ff1a8a8b7eaa71c218c09b8eca80ccda53807 /src
parentab67256fe8d9df5be95919852100f7f914ddbb81 (diff)
Fix incrementing download ID
Adapt DownloadManagerDelegateQt::m_currentId to https://chromium-review.googlesource.com/1144311 Change-Id: I74d0165b096d5d02261290a7f84fda420a2b146c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/core/download_manager_delegate_qt.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index 398bde710..c8b75a893 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -79,7 +79,7 @@ DownloadManagerDelegateQt::~DownloadManagerDelegateQt()
void DownloadManagerDelegateQt::GetNextId(const content::DownloadIdCallback& callback)
{
- callback.Run(++m_currentId);
+ callback.Run(m_currentId);
}
download::DownloadItem *DownloadManagerDelegateQt::findDownloadById(quint32 downloadId)
@@ -124,6 +124,8 @@ void DownloadManagerDelegateQt::removeDownload(quint32 downloadId)
bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem* item,
const content::DownloadTargetCallback& callback)
{
+ m_currentId = item->GetId();
+
// Keep the forced file path if set, also as the temporary file, so the check for existence
// will already return that the file exists. Forced file paths seem to be only used for
// store downloads and other special downloads, so they might never end up here anyway.
@@ -184,6 +186,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem*
if (webContents)
adapterClient = static_cast<WebContentsDelegateQt *>(webContents->GetDelegate())->adapterClient();
+ Q_ASSERT(m_currentId == item->GetId());
ProfileAdapterClient::DownloadItemInfo info = {
item->GetId(),
toQt(item->GetURL()),
@@ -284,8 +287,9 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content
if (web_contents)
adapterClient = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())->adapterClient();
+ // Chromium doesn't increase download ID when saving page.
ProfileAdapterClient::DownloadItemInfo info = {
- m_currentId + 1,
+ ++m_currentId,
toQt(web_contents->GetURL()),
download::DownloadItem::IN_PROGRESS,
0, /* totalBytes */