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

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/networkpluginurlinterceptor.h"
0010 #include "webengineviewer_export.h"
0011 #include <memory>
0012 class KActionCollection;
0013 class QWebEngineView;
0014 class QAction;
0015 namespace WebEngineViewer
0016 {
0017 class WebHitTestResult;
0018 class NetworkPluginUrlInterceptorInterface;
0019 class NetworkAccessManagerWebEnginePrivate;
0020 /**
0021  * @brief The InterceptorManager class
0022  * @author Laurent Montel <montel@kde.org>
0023  */
0024 class WEBENGINEVIEWER_EXPORT InterceptorManager : public QObject
0025 {
0026     Q_OBJECT
0027 public:
0028     explicit InterceptorManager(QWebEngineView *webEngine, KActionCollection *ac, QObject *parent = nullptr);
0029     ~InterceptorManager() override;
0030     void addInterceptor(WebEngineViewer::NetworkPluginUrlInterceptorInterface *interceptor);
0031     [[nodiscard]] QList<QAction *> interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const;
0032     void removeInterceptor(WebEngineViewer::NetworkPluginUrlInterceptorInterface *interceptor);
0033 
0034 private:
0035     std::unique_ptr<NetworkAccessManagerWebEnginePrivate> const d;
0036 };
0037 }