summaryrefslogtreecommitdiffstats
path: root/src/webenginequick/api/qquickwebenginedownloadrequest.cpp
blob: 2816a2ac1fb2cfdc5ed53150a83905ef066ce244 (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
33
34
35
36
// 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
// Qt-Security score:significant reason:default

#include "qquickwebenginedownloadrequest.h"
#include "qquickwebengineview_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)
{
}

/*!
    \property QQuickWebEngineDownloadRequest::view
    \brief The WebEngineView the download was requested on.

    If the download was not triggered by content in a WebEngineView,
    returns \nullptr.
*/
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.cpp"