File indexing completed on 2025-01-26 04:57:24

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "webengineviewer_export.h"
0010 #include <QWebEngineUrlRequestInterceptor>
0011 #include <memory>
0012 namespace WebEngineViewer
0013 {
0014 class NetworkUrlInterceptorPrivate;
0015 class NetworkPluginUrlInterceptorInterface;
0016 /**
0017  * @brief The NetworkUrlInterceptor class
0018  * @author Laurent Montel <montel@kde.org>
0019  */
0020 class WEBENGINEVIEWER_EXPORT NetworkUrlInterceptor : public QWebEngineUrlRequestInterceptor
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit NetworkUrlInterceptor(QObject *parent = nullptr);
0025     ~NetworkUrlInterceptor() override;
0026 
0027     void interceptRequest(QWebEngineUrlRequestInfo &info) override;
0028 
0029     void addInterceptor(NetworkPluginUrlInterceptorInterface *interceptor);
0030     void removeInterceptor(NetworkPluginUrlInterceptorInterface *interceptor);
0031 
0032 private:
0033     std::unique_ptr<NetworkUrlInterceptorPrivate> const d;
0034 };
0035 }