2 * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>.
4 * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
6 * Privacy Browser PC is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * Privacy Browser PC is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with Privacy Browser PC. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef PRIVACYWEBENGINEVIEW_H
21 #define PRIVACYWEBENGINEVIEW_H
23 // Qt toolkit headers.
25 #include <QNetworkCookie>
26 #include <QWebEngineFindTextResult>
27 #include <QWebEngineView>
29 class PrivacyWebEngineView : public QWebEngineView
31 // Include the Q_OBJECT macro.
35 // The default constructor.
36 explicit PrivacyWebEngineView();
38 // The public variables.
39 std::list<QNetworkCookie> *cookieListPointer = new std::list<QNetworkCookie>;
40 QString domainSettingsName = QStringLiteral("");
41 QIcon favoriteIcon = QIcon::fromTheme(QStringLiteral("globe"));
42 bool findCaseSensitive = false;
43 QString findString = QStringLiteral("");
44 QWebEngineFindTextResult findTextResult = QWebEngineFindTextResult();
45 bool isLoading = false;
46 int loadProgressInt = -1;
47 bool localStorageEnabled = false;
49 // The public functions.
50 void applyDomainSettings(const QString &hostname, const bool reloadWebsite);
54 void displayHttpPingBlockedDialog(const QString &httpPingUrl) const;
55 void updateCookiesAction(const int numberOfCookies) const;
56 void updateUi(const PrivacyWebEngineView *privacyWebEngineViewPointer) const;
60 void addCookieToList(const QNetworkCookie &cookie) const;
61 void removeCookieFromList(const QNetworkCookie &cookie) const;
65 void applyDomainSettingsWithoutReloading(const QString &hostname);
66 void displayHttpPingDialog(const QString &httpPingUrl) const;
69 // The private variables.
70 QWebEngineProfile *webEngineProfilePointer;
71 QWebEngineSettings *webEngineSettingsPointer;
74 // The protected functions.
75 void contextMenuEvent(QContextMenuEvent *contextMenuEvent) override;
76 QWebEngineView* createWindow(QWebEnginePage::WebWindowType webWindowType) override;