2 * Copyright 2022,2024 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 USERAGENTHELPER_H
21 #define USERAGENTHELPER_H
23 // Qt framework headers.
29 // The default constructor.
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;
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);
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;
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);