diff options
Diffstat (limited to 'src/webengine/blockerrule.h')
-rw-r--r-- | src/webengine/blockerrule.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/webengine/blockerrule.h b/src/webengine/blockerrule.h index 95d82b7..df09d10 100644 --- a/src/webengine/blockerrule.h +++ b/src/webengine/blockerrule.h @@ -24,6 +24,7 @@ #include <QObject> #include <QUrl> #include <QRegularExpression> +#include <QWebEngineUrlRequestInfo> class BlockerRule : public QObject { @@ -36,13 +37,33 @@ public: WildcardMatch }; + enum RuleOption { + script = 0, + image = 1, + stylesheet = 2, + object = 4, + xmlhttprequest = 8, + objectsubrequest = 16, + subdocument = 32, + ping = 64, + websocket = 128, + document = 256, + + elemhide = 512, + generichide = 1024, + genericblock = 2048, + + other = 4096 + }; + + Q_DECLARE_FLAGS(RuleOptions, RuleOption) + explicit BlockerRule(QString rule, QObject *parent = 0); - QString pattern() const; - QString domain() const; - bool match(const QUrl &url); + bool match(const QWebEngineUrlRequestInfo &info); bool isValid(); bool isException(); + QString toString() const; signals: @@ -52,10 +73,15 @@ private: // TODO: subclass QRegularExpression and move this there QString fromWildcardMatch(const QString &pattern); + QString m_rule; + RuleType m_type; bool m_exception = false; QString m_domain; QRegularExpression ruleExpression; + + RuleOptions m_blacklistOptions; + RuleOptions m_whitelistOptions; }; #endif // ADBLOCKRULE_H |