]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/helpers/UserAgentHelper.h
Block all CSP requests. https://redmine.stoutner.com/issues/1193
[PrivacyBrowserPC.git] / src / helpers / UserAgentHelper.h
1 /* SPDX-License-Identifier: GPL-3.0-or-later
2  * SPDX-FileCopyrightText: 2022, 2024 Soren Stoutner <soren@stoutner.com>
3  *
4  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc/>.
5  *
6  * This program is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License as published by the Free Software
8  * Foundation, either version 3 of the License, or (at your option) any later
9  * version.
10  *
11  * This program is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19
20 #ifndef USERAGENTHELPER_H
21 #define USERAGENTHELPER_H
22
23 // Qt framework headers.
24 #include <QString>
25
26 class UserAgentHelper
27 {
28 public:
29     // The default constructor.
30     UserAgentHelper();
31
32     // The destructor.
33     ~UserAgentHelper();
34
35     // The public static constants.
36     static const QString CHROMIUM_LINUX_DATABASE;
37     static const QString CHROMIUM_LINUX_USER_AGENT;
38     static const QString CHROME_WINDOWS_DATABASE;
39     static const QString CHROME_WINDOWS_USER_AGENT;
40     static const QString EDGE_WINDOWS_DATABASE;
41     static const QString EDGE_WINDOWS_USER_AGENT;
42     static const QString FIREFOX_LINUX_DATABASE;
43     static const QString FIREFOX_LINUX_USER_AGENT;
44     static const QString FIREFOX_WINDOWS_DATABASE;
45     static const QString FIREFOX_WINDOWS_USER_AGENT;
46     static const QString PRIVACY_BROWSER_DATABASE;
47     static const QString PRIVACY_BROWSER_USER_AGENT;
48     static const QString SAFARI_MACOS_DATABASE;
49     static const QString SAFARI_MACOS_USER_AGENT;
50     static const QString SYSTEM_DEFAULT_DATABASE;
51     static const QString WEB_ENGINE_DEFAULT_DATABASE;
52
53     // The public static functions.
54     static QString getDatabaseUserAgentNameFromUserAgent(const QString &userAgent);
55     static int getDomainSettingsUserAgentIndex(const QString &userAgentName);
56     static QString getUserAgentFromDatabaseName(const QString &userAgentDatabaseName);
57     static QString getResultingDomainSettingsUserAgent(const QString &rawUserAgent);
58
59     // The public variables.
60     QString SYSTEM_DEFAULT_TRANSLATED;
61     QString PRIVACY_BROWSER_TRANSLATED;
62     QString WEB_ENGINE_DEFAULT_TRANSLATED;
63     QString FIREFOX_LINUX_TRANSLATED;
64     QString CHROMIUM_LINUX_TRANSLATED;
65     QString FIREFOX_WINDOWS_TRANSLATED;
66     QString CHROME_WINDOWS_TRANSLATED;
67     QString EDGE_WINDOWS_TRANSLATED;
68     QString SAFARI_MACOS_TRANSLATED;
69
70     // The public functions.  Anything that accesses the translated user names must use an instantiated copy of the class.
71     QString getDatabaseUserAgentNameFromTranslatedName(const QString &translatedUserAgentName);
72     QString getUserAgentFromTranslatedName(const QString &userAgentTranslatedName);
73     QString getTranslatedUserAgentNameFromDatabaseName(const QString &userAgentName);
74 };
75 #endif