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 #pragma once 0007 0008 #include "webengineviewer_export.h" 0009 #include <QUrl> 0010 #include <QWebEngineUrlRequestInfo> 0011 #include <WebEngineViewer/NetworkPluginUrlInterceptorInterface> 0012 namespace WebEngineViewer 0013 { 0014 class WEBENGINEVIEWER_EXPORT BlockExternalResourcesUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit BlockExternalResourcesUrlInterceptor(QObject *parent = nullptr); 0019 ~BlockExternalResourcesUrlInterceptor() override; 0020 0021 [[nodiscard]] bool interceptRequest(QWebEngineUrlRequestInfo &info) override; 0022 // Used by autotest only 0023 [[nodiscard]] bool 0024 interceptRequest(const QUrl &url, QWebEngineUrlRequestInfo::ResourceType resourceType, QWebEngineUrlRequestInfo::NavigationType navigationType); 0025 void setEnabled(bool enabled); 0026 Q_SIGNALS: 0027 void formSubmittedForbidden(); 0028 0029 private: 0030 bool mEnabled = true; 0031 }; 0032 }