Falkon Develop
Cross-platform Qt-based web browser
networkmanager.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef NETWORKMANAGER_H
19#define NETWORKMANAGER_H
20
21#include <QNetworkAccessManager>
22#include <QWebEngineCertificateError>
23
24#include "qzcommon.h"
25
26class UrlInterceptor;
30
31class FALKON_EXPORT NetworkManager : public QNetworkAccessManager
32{
33 Q_OBJECT
34
35public:
36 explicit NetworkManager(QObject *parent = nullptr);
37
38 bool certificateError(QWebEngineCertificateError &error, QWidget *parent = nullptr);
39 void authentication(const QUrl &url, QAuthenticator *auth, QWidget *parent = nullptr);
40 void proxyAuthentication(const QString &proxyHost, QAuthenticator *auth, QWidget *parent = nullptr);
41
42 void installUrlInterceptor(UrlInterceptor *interceptor);
43 void removeUrlInterceptor(UrlInterceptor *interceptor);
44
45 void registerExtensionSchemeHandler(const QString &name, ExtensionSchemeHandler *handler);
46 void unregisterExtensionSchemeHandler(ExtensionSchemeHandler *handler);
47
48 void loadSettings();
49 void shutdown();
50
51 static void registerSchemes();
52
53protected:
54 QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData) override;
55
56private:
57 void saveIgnoredSslHosts();
58
59 NetworkUrlInterceptor *m_urlInterceptor;
60 ExtensionSchemeManager *m_extensionScheme;
61 QHash<QString, QWebEngineCertificateError::Type> m_ignoredSslErrors;
62 QHash<QString, QWebEngineCertificateError::Type> m_rejectedSslErrors;
63 QStringList m_ignoredSslHosts;
64};
65
66#endif // NETWORKMANAGER_H
#define FALKON_EXPORT
Definition: qzcommon.h:28