diff options
author | Tamas Zakor <ztamas@inf.u-szeged.hu> | 2019-02-12 16:54:20 +0100 |
---|---|---|
committer | Antti Kokko <antti.kokko@qt.io> | 2019-03-07 11:19:38 +0000 |
commit | ccf94031f44f15d12696051fe5db004cd47f51e5 (patch) | |
tree | 3234cfe4d86611047c2b54484f893dabb18cc17e /src | |
parent | b47b28d3cfb8b249cce343031507864de99117a7 (diff) |
Fix incrementing download ID
Adapt DownloadManagerDelegateQt::m_currentId to
https://chromium-review.googlesource.com/1144311
Update Chromium:
09516a434b [Backport] Allow DownloadManagerImpl to get InProgressDownloadManager from DownloadManagerService
b3edbf2a84 [Backport] Make DownloadManagerImpl to generate download IDs for in-progress DB
Task-number: QTBUG-70702
Change-Id: I1224643398a2084fcd5d70d2c04b105ed69c1f3d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8600d3d22d86be364a4c29e559dda7990594d0c5)
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src')
m--------- | src/3rdparty | 0 | ||||
-rw-r--r-- | src/core/download_manager_delegate_qt.cpp | 8 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject 493fab1afff5034cb5552455add3af3aaf41f9e +Subproject b3edbf2a84d96ed1d0307a8ef909b2f1f6c2a97 diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 948a62047..f0f0c93b9 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 */ |