| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #include "network-web/adblock/adblockurlinterceptor.h" |
| 4 | |
| 5 | #include "definitions/definitions.h" |
| 6 | #include "network-web/adblock/adblockmanager.h" |
| 7 | #include "network-web/adblock/adblockrequestinfo.h" |
| 8 | |
| 9 | AdBlockUrlInterceptor::AdBlockUrlInterceptor(AdBlockManager* manager) : UrlInterceptor(manager), m_manager(manager) {} |
| 10 | |
| 11 | void AdBlockUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) { |
| 12 | if (m_manager->block(AdblockRequestInfo(info)).m_blocked) { |
| 13 | info.block(true); |
| 14 | |
| 15 | qWarningNN << LOGSEC_ADBLOCK << "Blocked request:" << QUOTE_W_SPACE_DOT(info.requestUrl().toString()); |
| 16 | } |
| 17 | } |