diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/download_manager_delegate_qt.cpp | 21 | ||||
-rw-r--r-- | src/core/download_manager_delegate_qt.h | 4 | ||||
-rw-r--r-- | src/core/gl_surface_qt.cpp | 2 | ||||
-rw-r--r-- | src/core/web_contents_adapter.cpp | 2 |
4 files changed, 18 insertions, 11 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 5eb97c5ea..40df9b3a8 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -65,7 +65,7 @@ DownloadManagerDelegateQt::DownloadManagerDelegateQt(BrowserContextAdapter *cont : m_contextAdapter(contextAdapter) , m_currentId(0) , m_weakPtrFactory(this) - , m_downloadType(BrowserContextAdapterClient::Attachment) + , m_nextDownloadIsUserRequested(false) { Q_ASSERT(m_contextAdapter); } @@ -123,10 +123,17 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i QString suggestedFilename = toQt(item->GetSuggestedFilename()); QString mimeTypeString = toQt(item->GetMimeType()); - bool isAttachment = net::HttpContentDisposition(item->GetContentDisposition(), std::string()).is_attachment(); - - if (!isAttachment || !BrowserContextAdapterClient::UserRequested) - m_downloadType = BrowserContextAdapterClient::DownloadAttribute; + 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()); @@ -173,7 +180,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i false /* accepted */, false /* paused */, false /* done */, - m_downloadType, + downloadType, item->GetLastReason() }; @@ -308,7 +315,7 @@ void DownloadManagerDelegateQt::OnDownloadUpdated(content::DownloadItem *downloa true /* accepted */, download->IsPaused(), download->IsDone(), - m_downloadType, + 0 /* downloadType (unused) */, download->GetLastReason() }; diff --git a/src/core/download_manager_delegate_qt.h b/src/core/download_manager_delegate_qt.h index aec83cb41..df43211ed 100644 --- a/src/core/download_manager_delegate_qt.h +++ b/src/core/download_manager_delegate_qt.h @@ -86,7 +86,7 @@ public: void pauseDownload(quint32 downloadId); void resumeDownload(quint32 downloadId); - void setDownloadType(int downloadType) { m_downloadType = downloadType; } + void markNextDownloadAsUserRequested() { m_nextDownloadIsUserRequested = true; } // Inherited from content::DownloadItem::Observer void OnDownloadUpdated(content::DownloadItem *download) override; @@ -99,7 +99,7 @@ private: uint64_t m_currentId; base::WeakPtrFactory<DownloadManagerDelegateQt> m_weakPtrFactory; - int m_downloadType; + bool m_nextDownloadIsUserRequested; friend class DownloadManagerDelegateInstance; DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegateQt); diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index f731b0231..344a4459f 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -267,7 +267,7 @@ bool GLSurfaceQtGLX::Initialize(GLSurfaceFormat format) GLX_PBUFFER_HEIGHT, m_size.height(), GLX_LARGEST_PBUFFER, False, GLX_PRESERVED_CONTENTS, False, - GLX_NONE + 0 }; m_surfaceBuffer = glXCreatePbuffer(display, static_cast<GLXFBConfig>(g_config), pbuffer_attributes); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 5850b07b5..e6a97b8bc 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -974,7 +974,7 @@ void WebContentsAdapter::download(const QUrl &url, const QString &suggestedFileN if (!dlm) return; - dlmd->setDownloadType(BrowserContextAdapterClient::UserRequested); + dlmd->markNextDownloadAsUserRequested(); dlm->SetDelegate(dlmd); net::NetworkTrafficAnnotationTag traffic_annotation = |