| 1 | // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/network-web/adblock/adblockmanager.h`/ |
| 2 | |
| 3 | #ifndef ADBLOCKMANAGER_H |
| 4 | #define ADBLOCKMANAGER_Hcxx . . $ `src/librssguard/network-web/adblock/adblockmanager.h:4:9`! |
| 5 | |
| 6 | #include "miscellaneous/nodejs.h"cxx . . $ `<file>/src/librssguard/miscellaneous/nodejs.h`/ |
| 7 | |
| 8 | #include <QHash> |
| 9 | #include <QObject> |
| 10 | #include <QProcess> |
| 11 | |
| 12 | #define CLIQZ_ADBLOCKED_PACKAGEcxx . . $ `src/librssguard/network-web/adblock/adblockmanager.h:12:9`! "@ghostery/adblocker" |
| 13 | #define CLIQZ_ADBLOCKED_VERSIONcxx . . $ `src/librssguard/network-web/adblock/adblockmanager.h:13:9`! "2.5.1" |
| 14 | |
| 15 | class QUrlcxx . . $ QUrl#; |
| 16 | class AdblockRequestInfocxx . . $ AdblockRequestInfo#; |
| 17 | class AdBlockUrlInterceptorcxx . . $ AdBlockUrlInterceptor#; |
| 18 | class AdBlockIconcxx . . $ AdBlockIcon#; |
| 19 | |
| 20 | struct BlockingResultcxx . . $ BlockingResult# { |
| 21 | bool m_blockedcxx . . $ BlockingResult#m_blocked.; |
| 22 | QStringcxx . . $ QString# m_blockedByFiltercxx . . $ BlockingResult#m_blockedByFilter.; |
| 23 | |
| 24 | BlockingResultcxx . . $ BlockingResult#BlockingResult(49f6e7a06ebc5aa8).() : m_blockedcxx . . $ BlockingResult#m_blocked.(false), m_blockedByFiltercxx . . $ BlockingResult#m_blockedByFilter.(QStringcxx . . $ QString#QString(ced63f7c635d850d).()) {} |
| 25 | |
| 26 | BlockingResultcxx . . $ BlockingResult#BlockingResult(64b12fddccd2c229).(bool blocked, QStringcxx . . $ QString# blocked_by_filter =cxx . . $ QString#QString(ced63f7c635d850d). {}) |
| 27 | : m_blockedcxx . . $ BlockingResult#m_blocked.(blocked), m_blockedByFiltercxx . . $ QString#QString(28715ad661ad3cec).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(blocked_by_filter)) {} |
| 28 | }; |
| 29 | |
| 30 | class AdBlockManagercxx . . $ AdBlockManager# : public QObjectcxx . . $ QObject# { |
| 31 | Q_OBJECTcxx . . $ AdBlockManager#qt_staticMetaObjectRelocatingContent. |
| 32 | |
| 33 | public: |
| 34 | explicit AdBlockManagercxx . . $ AdBlockManager#AdBlockManager(749de1b6ae65bddd).(QObjectcxx . . $ QObject#* parent = nullptr); |
| 35 | virtual ~cxx . . $ AdBlockManager#`~AdBlockManager`(ced63f7c635d850d).AdBlockManagercxx . . $ AdBlockManager#(); |
| 36 | |
| 37 | // Enables (or disables) AdBlock feature asynchronously. |
| 38 | // This method will start/stop AdBlock in separate process |
| 39 | // and thus cannot run synchronously (when enabling) as process takes |
| 40 | // some time to start. |
| 41 | // |
| 42 | // If the process fails then signal processTerminated() is thrown. |
| 43 | // If AdBlock is switched on/off then signal enabledChanged(bool, QString) is thrown. |
| 44 | void setEnabledcxx . . $ AdBlockManager#setEnabled(b45ddcbc8423892c).(bool enabled); |
| 45 | bool isEnabledcxx . . $ AdBlockManager#isEnabled(50ce9a9e25b4a850).() const; |
| 46 | |
| 47 | bool canRunOnSchemecxx . . $ AdBlockManager#canRunOnScheme(f3b39adf77d9c36c).(const QStringcxx . . $ QString#& scheme) const; |
| 48 | AdBlockIconcxx . . $ AdBlockIcon#* adBlockIconcxx . . $ AdBlockManager#adBlockIcon(c28c2e98a16e03de).() const; |
| 49 | |
| 50 | // General methods for adblocking. |
| 51 | BlockingResultcxx . . $ BlockingResult# blockcxx . . $ AdBlockManager#block(b0689f1a9ed52a60).(const AdblockRequestInfocxx . . $ AdblockRequestInfo#& request); |
| 52 | QStringcxx . . $ QString# elementHidingRulesForDomaincxx . . $ AdBlockManager#elementHidingRulesForDomain(24eb2a72c77c93bc).(const QUrlcxx . . $ QUrl#& url) const; |
| 53 | |
| 54 | QStringListcxx . . $ QStringList# filterListscxx . . $ AdBlockManager#filterLists(2b25566bdf736d18).() const; |
| 55 | void setFilterListscxx . . $ AdBlockManager#setFilterLists(4c9f0945b8b27034).(const QStringListcxx . . $ QStringList#& filter_lists); |
| 56 | |
| 57 | QStringListcxx . . $ QStringList# customFilterscxx . . $ AdBlockManager#customFilters(2b25566bdf736d18).() const; |
| 58 | void setCustomFilterscxx . . $ AdBlockManager#setCustomFilters(4c9f0945b8b27034).(const QStringListcxx . . $ QStringList#& custom_filters); |
| 59 | |
| 60 | static QStringcxx . . $ QString# generateJsForElementHidingcxx . . $ AdBlockManager#generateJsForElementHiding(fd988a2ab94d906b).(const QStringcxx . . $ QString#& css); |
| 61 | |
| 62 | public slotscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:42:14`!: |
| 63 | void showDialogcxx . . $ AdBlockManager#showDialog(49f6e7a06ebc5aa8).(); |
| 64 | |
| 65 | signalscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:43:14`!: |
| 66 | void enabledChangedcxx . . $ AdBlockManager#enabledChanged(64b12fddccd2c229).(bool enabled, QStringcxx . . $ QString# error =cxx . . $ QString#QString(ced63f7c635d850d). {}); |
| 67 | void processTerminatedcxx . . $ AdBlockManager#processTerminated(49f6e7a06ebc5aa8).(); |
| 68 | |
| 69 | private slotscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:42:14`!: |
| 70 | void onPackageReadycxx . . $ AdBlockManager#onPackageReady(34ac6af3085f0564).(const QObjectcxx . . $ QObject#* sndr, const QListcxx . . $ QList#<NodeJscxx . . $ NodeJs#::PackageMetadatacxx . . $ NodeJs#PackageMetadata#>& pkgs, bool already_up_to_date); |
| 71 | void onPackageErrorcxx . . $ AdBlockManager#onPackageError(c66daf909bbebbbc).(const QObjectcxx . . $ QObject#* sndr, const QListcxx . . $ QList#<NodeJscxx . . $ NodeJs#::PackageMetadatacxx . . $ NodeJs#PackageMetadata#>& pkgs, const QStringcxx . . $ QString#& error); |
| 72 | void onServerProcessFinishedcxx . . $ AdBlockManager#onServerProcessFinished(15c350e1a5203cbf).(int exit_code, QProcesscxx . . $ QProcess#::ExitStatuscxx . . $ QProcess#ExitStatus# exit_status); |
| 73 | |
| 74 | private: |
| 75 | void updateUnifiedFilterscxx . . $ AdBlockManager#updateUnifiedFilters(49f6e7a06ebc5aa8).(); |
| 76 | void updateUnifiedFiltersFileAndStartServercxx . . $ AdBlockManager#updateUnifiedFiltersFileAndStartServer(49f6e7a06ebc5aa8).(); |
| 77 | |
| 78 | QProcesscxx . . $ QProcess#* startServercxx . . $ AdBlockManager#startServer(441b0ec0e9d37395).(int port); |
| 79 | void killServercxx . . $ AdBlockManager#killServer(49f6e7a06ebc5aa8).(); |
| 80 | |
| 81 | BlockingResultcxx . . $ BlockingResult# askServerIfBlockedcxx . . $ AdBlockManager#askServerIfBlocked(b85fa49265dbe04f).(const QStringcxx . . $ QString#& fp_url, const QStringcxx . . $ QString#& url, const QStringcxx . . $ QString#& url_type) const; |
| 82 | QStringcxx . . $ QString# askServerForCosmeticRulescxx . . $ AdBlockManager#askServerForCosmeticRules(5555d9024dcf93fb).(const QStringcxx . . $ QString#& url) const; |
| 83 | |
| 84 | private: |
| 85 | bool m_loadedcxx . . $ AdBlockManager#m_loaded.; |
| 86 | bool m_enabledcxx . . $ AdBlockManager#m_enabled.; |
| 87 | bool m_installingcxx . . $ AdBlockManager#m_installing.; |
| 88 | AdBlockIconcxx . . $ AdBlockIcon#* m_adblockIconcxx . . $ AdBlockManager#m_adblockIcon.; |
| 89 | |
| 90 | #if defined(NO_LITEcxx . . $ `<built-in>:500:9`!) |
| 91 | AdBlockUrlInterceptorcxx . . $ AdBlockUrlInterceptor#* m_interceptorcxx . . $ AdBlockManager#m_interceptor.; |
| 92 | #endif |
| 93 | |
| 94 | QStringcxx . . $ QString# m_unifiedFiltersFilecxx . . $ AdBlockManager#m_unifiedFiltersFile.; |
| 95 | QProcesscxx . . $ QProcess#* m_serverProcesscxx . . $ AdBlockManager#m_serverProcess.; |
| 96 | QHashcxx . . $ QHash#<QPaircxx . . $ QPair#<QStringcxx . . $ QString#, QStringcxx . . $ QString#>, BlockingResultcxx . . $ BlockingResult#> m_cacheBlockscxx . . $ AdBlockManager#m_cacheBlocks.; |
| 97 | }; |
| 98 | |
| 99 | inline AdBlockIconcxx . . $ AdBlockIcon#* AdBlockManagercxx . . $ AdBlockManager#::adBlockIconcxx . . $ AdBlockManager#adBlockIcon(c28c2e98a16e03de).() const { |
| 100 | return m_adblockIconcxx . . $ AdBlockManager#m_adblockIcon.; |
| 101 | } |
| 102 | |
| 103 | #endif // ADBLOCKMANAGER_H |