| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | // |
| 4 | // Copyright (C) 2011-2017 by Martin Rotter <[email protected]> |
| 5 | // Copyright (C) 2010-2014 by David Rosca <[email protected]> |
| 6 | // |
| 7 | // RSS Guard is free software: you can redistribute it and/or modify |
| 8 | // it under the terms of the GNU General Public License as published by |
| 9 | // the Free Software Foundation, either version 3 of the License, or |
| 10 | // (at your option) any later version. |
| 11 | // |
| 12 | // RSS Guard is distributed in the hope that it will be useful, |
| 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | // GNU General Public License for more details. |
| 16 | // |
| 17 | // You should have received a copy of the GNU General Public License |
| 18 | // along with RSS Guard. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | #ifndef NETWORKURLINTERCEPTOR_H |
| 21 | #define NETWORKURLINTERCEPTOR_H |
| 22 | |
| 23 | #include <QWebEngineUrlRequestInterceptor> |
| 24 | |
| 25 | class UrlInterceptor; |
| 26 | |
| 27 | class NetworkUrlInterceptor : public QWebEngineUrlRequestInterceptor { |
| 28 | Q_OBJECT |
| 29 | |
| 30 | public: |
| 31 | explicit NetworkUrlInterceptor(QObject* parent = nullptr); |
| 32 | |
| 33 | void interceptRequest(QWebEngineUrlRequestInfo& info) Q_DECL_OVERRIDE; |
| 34 | |
| 35 | void installUrlInterceptor(UrlInterceptor* interceptor); |
| 36 | void removeUrlInterceptor(UrlInterceptor* interceptor); |
| 37 | |
| 38 | void load(); |
| 39 | |
| 40 | private: |
| 41 | QList<UrlInterceptor*> m_interceptors; |
| 42 | bool m_sendDnt; |
| 43 | }; |
| 44 | |
| 45 | #endif // NETWORKURLINTERCEPTOR_H |