diff options
author | Andras Becsi <andras.becsi@theqtcompany.com> | 2014-12-11 19:57:58 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@theqtcompany.com> | 2015-01-12 16:34:58 +0100 |
commit | e6a74159cebdbfec575f40469c216c90ee8651c1 (patch) | |
tree | 331f7a51b9d0c77568bb2744fbd8155733424374 /src/webengine/api/qquickwebengineprofile_p_p.h | |
parent | 4557ccd9785f53abc11460211c84db3e564b364f (diff) |
Add QML download API
This patch exposes downloadStarted and downloadFinished
signals on the WebEngineProfile to notify about downloads.
The WebEngineDownloadItem exposes a subset of Chromium's
content::DownloadItem functionality.
For now we expose minimal requirements to be able to control
downloads in QML but this can be extended in the future.
This patch also adds a DownloadView to quicktestbrowser
to demonstrate the usage of the new API.
[ChangeLog][QtWebEngineQML] Add QtQuick download API
Change-Id: I8d8f0daf02c4e0151000427fc2a4b37d28b9db52
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/webengine/api/qquickwebengineprofile_p_p.h')
-rw-r--r-- | src/webengine/api/qquickwebengineprofile_p_p.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/webengine/api/qquickwebengineprofile_p_p.h b/src/webengine/api/qquickwebengineprofile_p_p.h index d71dcfda9..18ccfc467 100644 --- a/src/webengine/api/qquickwebengineprofile_p_p.h +++ b/src/webengine/api/qquickwebengineprofile_p_p.h @@ -39,21 +39,37 @@ class BrowserContextAdapter; +#include "browser_context_adapter_client.h" +#include "qquickwebengineprofile_p.h" + #include <QExplicitlySharedDataPointer> +#include <QMap> +#include <QPointer> QT_BEGIN_NAMESPACE - -class QQuickWebEngineProfilePrivate { +class QQuickWebEngineDownloadItem; +class QQuickWebEngineProfilePrivate + : public BrowserContextAdapterClient +{ public: + Q_DECLARE_PUBLIC(QQuickWebEngineProfile) QQuickWebEngineProfilePrivate(BrowserContextAdapter* browserContext, bool ownsContext); ~QQuickWebEngineProfilePrivate(); BrowserContextAdapter *browserContext() const { return m_browserContext; } + void cancelDownload(quint32 downloadId); + void downloadDestroyed(quint32 downloadId); + + void downloadRequested(quint32 downloadId, QString &downloadPath, bool &cancelled) Q_DECL_OVERRIDE; + void downloadUpdated(quint32 downloadId, int downloadState, int percentComplete) Q_DECL_OVERRIDE; + private: friend class QQuickWebEngineViewPrivate; + QQuickWebEngineProfile *q_ptr; BrowserContextAdapter *m_browserContext; QExplicitlySharedDataPointer<BrowserContextAdapter> m_browserContextRef; + QMap<quint32, QPointer<QQuickWebEngineDownloadItem> > m_ongoingDownloads; }; QT_END_NAMESPACE |