diff options
Diffstat (limited to 'src/core/download_manager_delegate_qt.cpp')
-rw-r--r-- | src/core/download_manager_delegate_qt.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 191bb2267..40df9b3a8 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -65,6 +65,7 @@ DownloadManagerDelegateQt::DownloadManagerDelegateQt(BrowserContextAdapter *cont : m_contextAdapter(contextAdapter) , m_currentId(0) , m_weakPtrFactory(this) + , m_nextDownloadIsUserRequested(false) { Q_ASSERT(m_contextAdapter); } @@ -122,6 +123,18 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i QString suggestedFilename = toQt(item->GetSuggestedFilename()); QString mimeTypeString = toQt(item->GetMimeType()); + int downloadType = 0; + if (m_nextDownloadIsUserRequested) { + downloadType = BrowserContextAdapterClient::UserRequested; + m_nextDownloadIsUserRequested = false; + } else { + bool isAttachment = net::HttpContentDisposition(item->GetContentDisposition(), std::string()).is_attachment(); + if (isAttachment) + downloadType = BrowserContextAdapterClient::Attachment; + else + downloadType = BrowserContextAdapterClient::DownloadAttribute; + } + if (suggestedFilename.isEmpty()) suggestedFilename = toQt(net::HttpContentDisposition(item->GetContentDisposition(), std::string()).filename()); @@ -167,7 +180,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i false /* accepted */, false /* paused */, false /* done */, - false /* isSavePageDownload */, + downloadType, item->GetLastReason() }; @@ -262,7 +275,7 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content acceptedByDefault, false, /* paused */ false, /* done */ - true /* isSavePageDownload */, + BrowserContextAdapterClient::SavePage, BrowserContextAdapterClient::NoReason }; @@ -302,7 +315,7 @@ void DownloadManagerDelegateQt::OnDownloadUpdated(content::DownloadItem *downloa true /* accepted */, download->IsPaused(), download->IsDone(), - download->IsSavePackageDownload(), + 0 /* downloadType (unused) */, download->GetLastReason() }; |