File indexing completed on 2025-03-09 04:47:03

0001 /*
0002     SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "donottrackinterceptorinterface.h"
0008 #include "donottracksettings.h"
0009 #include <QtWebEngineCore/qwebengineurlrequestinfo.h>
0010 
0011 DoNotTrackInterceptorInterface::DoNotTrackInterceptorInterface(QObject *parent)
0012     : WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
0013 {
0014 }
0015 
0016 DoNotTrackInterceptorInterface::~DoNotTrackInterceptorInterface() = default;
0017 
0018 bool DoNotTrackInterceptorInterface::interceptRequest(QWebEngineUrlRequestInfo &info)
0019 {
0020     if (DoNotTrackSettings::doNotTrack()) {
0021         info.setHttpHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1"));
0022     }
0023     return false;
0024 }
0025 
0026 #include "moc_donottrackinterceptorinterface.cpp"