Index: include/AdblockPlus/FilterEngine.h |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/include/AdblockPlus/FilterEngine.h |
@@ -0,0 +1,34 @@ |
+#include <vector> |
+#include <string> |
+ |
+namespace AdblockPlus |
+{ |
+ class JsEngine; |
+ |
+ struct Subscription |
+ { |
+ std::string url; |
+ std::string title; |
Wladimir Palant
2013/04/03 13:42:41
We'll need to expose many more subscription proper
Felix Dahlke
2013/04/04 05:10:52
Sure, sounds reasonable. My intention was to go wi
|
+ |
+ Subscription(const std::string& url, const std::string& title); |
+ }; |
+ |
+ class FilterEngine |
+ { |
+ public: |
+ explicit FilterEngine(JsEngine& jsEngine); |
+ void AddSubscription(Subscription subscription); |
+ void RemoveSubscription(const Subscription& subscription); |
+ const Subscription* FindSubscription(const std::string& url) const; |
Wladimir Palant
2013/04/03 13:42:41
This should be called GetSubscription() - ABP code
Felix Dahlke
2013/04/04 05:10:52
Oh, didn't notice. Sure :)
|
+ const std::vector<Subscription>& GetSubscriptions() const; |
+ void UpdateSubscriptionFilters(const Subscription& subscription); |
+ std::vector<Subscription> FetchAvailableSubscriptions(); |
Wladimir Palant
2013/04/03 13:42:41
This is usually an asynchronous action (via XMLHtt
Felix Dahlke
2013/04/04 05:10:52
Yeah, not sure why I didn't do that actually...
|
+ bool Matches(const std::string& url, |
+ const std::string& contentType) const; |
Wladimir Palant
2013/04/03 13:42:41
We need to pass documentUrl as well here at the ve
Felix Dahlke
2013/04/04 05:10:52
You're right, it's quite lacking. I had the idea t
|
+ std::vector<std::string> GetElementHidingRules() const; |
+ |
+ private: |
+ JsEngine& jsEngine; |
+ std::vector<Subscription> subscriptions; |
+ }; |
+} |
Wladimir Palant
2013/04/03 13:42:41
General note: maybe Subscription should be a class
Felix Dahlke
2013/04/04 05:10:52
Yes, that would be a nicer design. As I noted befo
|