summaryrefslogtreecommitdiffstats
path: root/src/core/download_manager_delegate_qt.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Allow cancelling automatically accepted download requestsSzabolcs David2023-10-171-2/+5
| | | | | | | | | | | | | Calling QWebEngineDownloadRequest::cancel() had no effect if the download request was accepted by default. These downloads had no corresponding internal DownloadItem yet, but we tried to cancel them using the DownloadManager. The safest option is to always check if the DownloadItem exists in Chromium. Pick-to: 6.6 Task-number: QTBUG-117624 Change-Id: I8f92d45e00e088aea7d22d5b7271b5b09adf6cbb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Support auto accepting non-HTML saves when a path was specifiedSzabolcs David2023-10-011-1/+6
| | | | | | | | | | | | | | | Images and PDFs had to be explicitly accepted to download, even if a filePath was given as argument of QWebEnginePage::save(). This behavior was inconsistent with saving HTML pages (and the documentation). Adjust the corresponding test case with verifying the download result of an auto-accepted download, and add a new test case to make sure about downloads are not accepted by default when there is no desired filePath. Pick-to: 6.6 Task-number: QTBUG-117624 Change-Id: I90f4cfa485da2831327bcb25571a0b69499d9006 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Support filePath argument of save() when saving non-HTML filesSzabolcs David2023-10-011-3/+15
| | | | | | | | | | | | | | Currently the filePath argument of QWebEnginePage::save() is ignored when the user tries to download anything but HTML; and the requested download path is the Downloads folder of the OS. Fix this and adjust the corresponding test case with checking path and file name of the download request. Pick-to: 6.6 Task-number: QTBUG-117624 Change-Id: Ia1d3afc898b1aad223aab772b775724a50e88bd3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Improve QWebEngineDownloadRequest::isSavePageDownload()Szabolcs David2023-09-281-15/+23
| | | | | | | | | | | | | | | | | | | WebContentsImpl::IsSavable() decides which file formats are saveable, but it allows this only for text-based files. All other files will go around on the code path of downloading. MHTML (multipart) and PDF files are saved like this, which means they aren't marked as isSavePageDownload. Just simply set this flag if the save was requested by the user even if it was a download. This fixes the flag for saving MHTML and PDF files from context menu, and leaves the flag false when a PDF download was initiated by the button of the web UI. Pick-to: 6.6 Task-number: QTBUG-114859 Change-Id: Id65f26a96952c5a43876338ad37f40570e544f3a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix initialization of QWebEngineDownloadRequest::totalBytes for WidgetsPeter Varga2023-03-011-1/+1
| | | | | | | | | | | | QQuickWebEngineProfile already initializes totalBytes. Also clean up QWebEngineDownloadRequestPrivate and fix typo in documentation. Pick-to: 5.15 6.4 6.5 Fixes: QTBUG-104869 Change-Id: I8c4b79c076ddc63180960e22a9488b45ff6c4402 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adaptations for 106-basedAllan Sandfeld Jensen2022-11-281-3/+0
| | | | | | Change-Id: I2fe91c06ce91dfaace7825a0589b56ee375479b6 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for 104-basedAllan Sandfeld Jensen2022-11-281-0/+3
| | | | | | Change-Id: Ieb44b5c98b3342adca38916d8b77c54e8ed8e1d7 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-3/+3
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I4b5f85df579532c2af938fe70db945ba273782fb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Adaptations for Chromium 102Allan Sandfeld Jensen2022-08-041-0/+3
| | | | | | Pick-to: 6.4 Change-Id: I7ef0ad616f2ea0fae482253335e95998aa2d360e Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for Chromium 100Allan Sandfeld Jensen2022-08-041-2/+2
| | | | | | Pick-to: 6.4 Change-Id: I217c87657f544a2e868de7291353ff1143e20902 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Various clean-upsPeter Varga2022-06-241-4/+0
| | | | | | Pick-to: 6.4 Change-Id: I53e04a247a25149d9f29135484c0528c706de7d8 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-221-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I869ffda1080e283f231eb0dc4477b260f2054d99 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Adaptations for Chromium 92Allan Sandfeld Jensen2021-12-021-6/+6
| | | | | Change-Id: I1849c130ca75615802744275f6e4212a755c39b4 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Workaround for downloading file into the root directory on WindowsPeter Varga2021-10-121-0/+8
| | | | | | | | | | | | | A bug in QtBase breaks downloading files into a root directory on Windows (eg. C:\): QTBUG-85997 Check if the "non-existent" directory is an existing drive and do not cancel the download in this case. Fixes: QTBUG-96855 Pick-to: 6.2 Change-Id: Icf0e472df723fc4f6ad36f4560509aafa69e3582 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2021-02-021-2/+5
|\ | | | | | | | | | | | | Conflicts: tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp Change-Id: Ibf03467e398f8dcdb5f950e1a70f3e4e591003db
| * Do not extract download file names from certain url schemesMichael Brüning2021-01-221-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Chromium uses the default download file name if the scheme of a file to download is either about or data, as the file name extraction methods do not seems to work for those. Mimic this behavior in Qt WebEngine as well. Fixes: QTBUG-90355 Change-Id: I14b8c4f64559500d3f231dd26533a5947bf94bc3 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2021-01-251-0/+3
|\| | | | | | | | | | | Including update to 87-based Change-Id: I36b6054e00de97ab055d0bc800cff08d0408fac6
| * Adaptations for Chromium 85Allan Sandfeld Jensen2021-01-131-0/+3
| | | | | | | | | | Change-Id: I33c1af7c431055d95e0fb540246765cce684de15 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* | Merge remote-tracking branch 'origin/5.15' into devAllan Sandfeld Jensen2020-09-141-19/+24
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty src/core/certificate_error_controller.cpp src/core/certificate_error_controller.h src/core/compositor/compositor.cpp src/core/compositor/compositor.h src/core/compositor/display_gl_output_surface.cpp src/core/content_browser_client_qt.cpp src/core/core_chromium.pri src/core/delegated_frame_host_client_qt.cpp src/core/ozone/gl_share_context_qt.h src/core/ozone/surface_factory_qt.cpp src/core/permission_manager_qt.cpp src/core/render_widget_host_view_qt.cpp src/core/render_widget_host_view_qt.h src/core/web_engine_context.cpp src/core/web_engine_settings.cpp src/core/web_event_factory.cpp tests/auto/widgets/qwebenginedownloadrequest/tst_qwebenginedownloadrequest.cpp Change-Id: Ice14c3c350b139e800c7c7011b7cef1fc7010669
| * Chromium 81-based adaptationsAllan Sandfeld Jensen2020-09-091-19/+24
| | | | | | | | | | Change-Id: Ie422b327025da084bc8038c7a0aadee2db801f29 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* | Remove obsolete, deprecated api from qwebenginedownloaditemMichal Klocek2020-08-181-14/+2
|/ | | | | | | | | | This patch removes: * path() * type() * DownloadType enum Change-Id: I3e29f9e8ce9e39b015c57cb7005e0290d1496291 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Adaptations for Chromium 80Allan Sandfeld Jensen2020-04-071-24/+4
| | | | | Change-Id: Icaf68648cbc2c13a61fc3b208ff1e64ca36c90b6 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Adaptations for Chromium 79Allan Sandfeld Jensen2020-02-281-4/+2
| | | | | | | | Fixes: QTBUG-80737 Fixes: QTBUG-81556 Fixes: QTBUG-81614 Change-Id: Ie6a69cdbf46d0508bff226f1b8fed28a618e1949 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix 'setDownloadDirectory' for download item on 'SavePage' actionKirill Burtsev2019-11-291-1/+1
| | | | | | | | | | | | | | Chromium's DownloadManager doesn't create its download items before path for saving page is confirmed. So assert inside updateDownloadPath was not correct. Moreover, the name is confusing because it's not really updating anything. Remove it and use ProfileAdapterClient::DownloadInfo timestamp to determine updated filename after directory change. Ammends recent new api for changing download directory 0884fab3b1. Fixes: QTBUG-80372 Change-Id: If9efb52979deb3cf21fc4e12989173c85e04e090 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Add API to change download directory path and file nameTamas Zakor2019-07-051-22/+9
| | | | | | | | | | | | | | | | | | Add functions and property to change the download directory and file name in QWebEngineDownloadItem and QQuickWebEngineDownloadItem and deprecate the path() and setPath(). Regenerating the uniquifying download filename after change the download directory. [ChangeLog][DownloadItem] Add functions and property to change the download directory and file name in QWebEngineDownloadItem and QQuickWebEngineDownloadItem and deprecate the path() and setPath(). Task-number: QTBUG-56978 Change-Id: I6e63da82a187add8bc3206cc80c8bf6865fbdd35 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add API to get the suggested download file nameTamas Zakor2019-05-161-3/+7
| | | | | | | | | [ChangeLog][DownloadItem] Add functions and property to get the suggested download file name. Task-number: QTBUG-56978 Change-Id: I902870c6358271322da613a15ccc11639384e404 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge branch '5.12' into 5.13Allan Sandfeld Jensen2019-04-091-2/+9
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty src/core/renderer/user_resource_controller.cpp src/core/web_contents_adapter.cpp src/webengine/doc/src/qtwebengine-overview.qdoc Change-Id: I46be9d33b3b65d61dfa099ee72a3509afb9bd6a4
| * Normalize download path on WindowsPeter Varga2019-04-051-1/+1
| | | | | | | | | | | | | | Task-number: QTBUG-74698 Task-number: QTBUG-74251 Change-Id: I4358feb7fb28b226edb24ed10611e797fcd3c326 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| * Fix timestamp deduplication for WindowsPeter Varga2019-03-281-2/+9
| | | | | | | | | | | | | | | | Based on https://chromium-review.googlesource.com/c/chromium/src/+/1432882 Task-number: QTBUG-74764 Change-Id: I74b4711f5146d2d2261487f13ccac702b9aa969e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
| * Fix incrementing download IDTamas Zakor2019-02-281-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Normalize download path on WindowsAllan Sandfeld Jensen2019-03-261-1/+1
| | | | | | | | | | | | Task-number: QTBUG-74698 Change-Id: I3fd4b932b1d4b0ecc844818f87c1824eac1f56e6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Adaptations for Chromium 73Allan Sandfeld Jensen2019-03-231-1/+1
| | | | | | | | | | Change-Id: I565d1e327852110a5abebed3388d7cd6986bef06 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* | Fix incrementing download IDTamas Zakor2019-02-141-2/+6
| | | | | | | | | | | | | | | | Adapt DownloadManagerDelegateQt::m_currentId to https://chromium-review.googlesource.com/1144311 Change-Id: I74d0165b096d5d02261290a7f84fda420a2b146c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Add API to set default download pathTamas Zakor2019-01-301-1/+1
|/ | | | | | | | | | | | | | | | | | | Add functions and property to set the default download location in QWebEngineProfile and QQuickWebEngineProfile. Also add new test for check uniquifying download filename. Update plugins.qmltypes to 1.9 [ChangeLog][Profile][QtWebEngine][QtWebEngineWidgets] Add functions and property to set the default download location in QWebEngineProfile and QQuickWebEngineProfile. Task-number: QTBUG-66262 Task-number: QTBUG-72176 Change-Id: I7fa93b66c326766b176aec24d453dd75602b91de Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove download items internally when API objects are deletedAllan Sandfeld Jensen2019-01-211-10/+20
| | | | | | | | | | We were never removing internal download item. [ChangeLog][Behavioral Changes] Deleting a download item will now also cancel it if it is still in progress. Change-Id: I2fab497d7acf7ca6ca17f4a61e106b1c18bfb333 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Fix uniquifying download filenameTamas Zakor2019-01-021-8/+8
| | | | | | | | | | | | | The QFileInfo::baseName() can’t be used to split the filename when it contains a dot what is not for extension. Moreover, use timestamps after 100 numerically deduplicated filenames as chrome do: https://chromium-review.googlesource.com/c/1278137 Task-number: QTBUG-66262 Change-Id: Ice548ba2824bd43cf7ad00509b598853087274af Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fallback to Latin-1 if ASCII and UTF-8 doesn't workAllan Sandfeld Jensen2018-09-051-1/+2
| | | | | | | | | | Latin-1 is a standard fallback for HTTP headers, but no one that HTTPContentDisposition::Parse considers by default. Task-number: QTBUG-70288 Change-Id: Ife36fffe31da5492cde49a4d447cfc42b3f64b95 Reviewed-by: Zakor Tamas <ztamas@inf.u-szeged.hu> Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Add QWebEngineDownloadItem page/view accessorAllan Sandfeld Jensen2018-08-021-3/+20
| | | | | | | | | | To be able to determine where a download was triggered. [ChangeLog][DownloadItem] Added a page/view accessor to tell were the download was triggered. Change-Id: I21843a545a3e0eb66f5e5fa8a50e77564f2118a7 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Rename BrowserAdapterClient to ProfileAdapterClientMichal Klocek2018-07-091-21/+21
| | | | | Change-Id: I1f8c0d2e59c2565b24c8c636553f1b70bcd31774 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Rename BrowserContextAdapter to ProfileAdapterMichal Klocek2018-07-091-10/+10
| | | | | | | | | Follow change of BrowserContextQt to ProfileQt. Fix wrong naming usage of browserContext instead of browserContextAdapter. Change-Id: I75fdac685d9bffd44f0144921d3e87305d6d44c9 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Finalize change from BrowserContext to ProfileMichal Klocek2018-07-061-3/+3
| | | | | | | | | | Changes 6c319ce and af313cb splited BrowserContextQt into ProfileQt and ProfileIODataQt. Finalize the change and rename leftover browserContext references to follow the initial change. Change-Id: I845142b1edb67ec4b94439be1e6cfc841dd3f55c Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Adaptations for Chromium 66Allan Sandfeld Jensen2018-06-261-19/+19
| | | | | Change-Id: Iee88721a50036d4ef85a23dd1708d4fb84218708 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Use range-based for instead of Q_FOREACHJüri Valdmann2018-06-061-3/+3
| | | | | Change-Id: Ibf016b795ff98fddfa29fb5dc63924a2d2159d71 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Rename BrowserContextQt to ProfileQtMichal Klocek2018-05-251-3/+3
| | | | | | | | | | | | Following commits are going to introduce ProfileIODataQt and to keep things self documented just rename the class so it reflects Chromium one. Fix minor style issues in profile_qt.h Presort include headers as requested on review. Change-Id: If58f5aec8ac64cfaf30642195838a77497b75244 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Implement IsMostRecentDownloadItemAtFilePath callMichal Klocek2018-03-181-0/+20
| | | | | | | | | Implement IsMostRecentDownloadItemAtFilePath for download_manager_delegate_qt. This is required for CVE-2018-6033. Change-Id: I979b77042facf7d3acaef5eda7a6e842f715a1ef Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fixup merge of downloadType from 5.10.1Allan Sandfeld Jensen2018-02-211-3/+16
| | | | | | | | | | | | | In 5.11 we deprecated downloadType and at the same time ripped out most of the faulty logic. Later we partially fixed the logic in 5.10.1, but kept the 5.11 version during the merge. This restores the improved logic from 5.10.1, while keeping the property deprecated since it is still misleading at times. Change-Id: I12ee09a2b212506f7ba1a336c9c2e88aa3b1de24 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Deprecate download typeJüri Valdmann2018-01-021-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the download type property from QtWebEngineCore and replaces it with a simple boolean 'isSavePageDownload'. On the public API boundary the type property is reimplemented via this boolean and documented as obsolete. Rationale being that 1. This feature seems to lack practical use cases, other than perhaps distinguishing save-page downloads from normal file downloads, which can be done in a much simpler way. 2. This feature does not work as documented and never has. So far nobody has complained, hinting again at a lack of practical use cases. 3. In order to fix it we would need to maintain patches on top of Chromium and Blink (we would, for example, need to propagate the DownloadAttribute type from Blink to Chromium to WebEngine). [ChangeLog][Deprecation Notice] (QWebEngine)DownloadItem::type() is deprecated and replaced with the newly introduced isSavePageDownload() property. Task-number: QTBUG-62640 Change-Id: Icf4e1e5a635028986df7eab979f4c0527902ff0c Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for Chromium 59Allan Sandfeld Jensen2017-09-111-4/+7
| | | | | Change-Id: I472053e316bfa782d0a6fb8903f4901be12247ae Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Implement pause and resume action in Download ItemsAllan Sandfeld Jensen2017-06-231-0/+22
| | | | | | | | | Adds the ability to pause downloads, and resume paused or interrupted downloads. Task-number: QTBUG-56840 Change-Id: I018bd30c3a772a36d48e4154d94f69cb8d8319e4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into devAllan Sandfeld Jensen2017-01-181-1/+1
|\ | | | | | | Change-Id: If16bfc6f0fbfd0040e13a8a3cbaa113fda10f387