summaryrefslogtreecommitdiffstats
path: root/src/webenginequick/api/qquickwebenginedownloadrequest.cpp
blob: f745ba3b3095005a1fcaea25e20e088d1df1b595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qquickwebenginedownloadrequest_p.h"
#include "QtWebEngineCore/private/qwebenginedownloadrequest_p.h"

#include "web_contents_adapter_client.h"

QT_BEGIN_NAMESPACE

/*!
    \internal
*/
QQuickWebEngineDownloadRequest::QQuickWebEngineDownloadRequest(QWebEngineDownloadRequestPrivate *p, QObject *parent)
    : QWebEngineDownloadRequest(p, parent)
{
}

/*!
    \internal
    Returns the WebEngineView the download was requested on. If the download was not triggered by content in a WebEngineView,
    \c nullptr is returned.
*/
QQuickWebEngineView *QQuickWebEngineDownloadRequest::view() const
{
    Q_ASSERT(d_ptr->adapterClient->clientType() == QtWebEngineCore::WebContentsAdapterClient::QmlClient);
    return const_cast<QQuickWebEngineView *>(static_cast<const QQuickWebEngineView *>(d_ptr->adapterClient->holdingQObject()));
}

QT_END_NAMESPACE

#include "moc_qquickwebenginedownloadrequest_p.cpp"