| OLD | NEW |
| 1 #ifndef ADBLOCKPLUS_FILTER_ENGINE_H | 1 #ifndef ADBLOCKPLUS_FILTER_ENGINE_H |
| 2 #define ADBLOCKPLUS_FILTER_ENGINE_H | 2 #define ADBLOCKPLUS_FILTER_ENGINE_H |
| 3 | 3 |
| 4 #include <vector> | 4 #include <vector> |
| 5 #include <map> | 5 #include <map> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <AdblockPlus/JsEngine.h> |
| 7 #include <AdblockPlus/JsValue.h> | 8 #include <AdblockPlus/JsValue.h> |
| 8 | 9 |
| 9 #include "tr1_memory.h" | 10 #include "tr1_memory.h" |
| 10 | 11 |
| 11 namespace AdblockPlus | 12 namespace AdblockPlus |
| 12 { | 13 { |
| 13 class JsEngine; | |
| 14 class FilterEngine; | 14 class FilterEngine; |
| 15 | 15 |
| 16 #if FILTER_ENGINE_STUBS | 16 #if FILTER_ENGINE_STUBS |
| 17 class JsObject | 17 class JsObject |
| 18 #else | 18 #else |
| 19 class JsObject : public JsValue | 19 class JsObject : public JsValue |
| 20 #endif | 20 #endif |
| 21 { | 21 { |
| 22 public: | 22 public: |
| 23 std::string GetProperty(const std::string& name, const std::string& defaultV
alue) const; | 23 std::string GetProperty(const std::string& name, const std::string& defaultV
alue) const; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 typedef void (*SubscriptionsCallback)(const std::vector<SubscriptionPtr>&); | 106 typedef void (*SubscriptionsCallback)(const std::vector<SubscriptionPtr>&); |
| 107 | 107 |
| 108 class FilterEngine | 108 class FilterEngine |
| 109 { | 109 { |
| 110 #if FILTER_ENGINE_STUBS | 110 #if FILTER_ENGINE_STUBS |
| 111 friend class Filter; | 111 friend class Filter; |
| 112 friend class Subscription; | 112 friend class Subscription; |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 public: | 115 public: |
| 116 explicit FilterEngine(JsEngine& jsEngine); | 116 explicit FilterEngine(JsEnginePtr jsEngine); |
| 117 FilterPtr GetFilter(const std::string& text); | 117 FilterPtr GetFilter(const std::string& text); |
| 118 SubscriptionPtr GetSubscription(const std::string& url); | 118 SubscriptionPtr GetSubscription(const std::string& url); |
| 119 const std::vector<FilterPtr> GetListedFilters() const; | 119 const std::vector<FilterPtr> GetListedFilters() const; |
| 120 const std::vector<SubscriptionPtr> GetListedSubscriptions() const; | 120 const std::vector<SubscriptionPtr> GetListedSubscriptions() const; |
| 121 void FetchAvailableSubscriptions(SubscriptionsCallback callback); | 121 void FetchAvailableSubscriptions(SubscriptionsCallback callback); |
| 122 FilterPtr Matches(const std::string& url, | 122 FilterPtr Matches(const std::string& url, |
| 123 const std::string& contentType, | 123 const std::string& contentType, |
| 124 const std::string& documentUrl); | 124 const std::string& documentUrl); |
| 125 std::vector<std::string> GetElementHidingSelectors(const std::string& domain
) const; | 125 std::vector<std::string> GetElementHidingSelectors(const std::string& domain
) const; |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 JsEngine& jsEngine; | 128 JsEnginePtr jsEngine; |
| 129 #if FILTER_ENGINE_STUBS | 129 #if FILTER_ENGINE_STUBS |
| 130 std::map<std::string, FilterPtr> knownFilters; | 130 std::map<std::string, FilterPtr> knownFilters; |
| 131 std::vector<FilterPtr> listedFilters; | 131 std::vector<FilterPtr> listedFilters; |
| 132 std::map<std::string, SubscriptionPtr> knownSubscriptions; | 132 std::map<std::string, SubscriptionPtr> knownSubscriptions; |
| 133 std::vector<SubscriptionPtr> listedSubscriptions; | 133 std::vector<SubscriptionPtr> listedSubscriptions; |
| 134 #endif | 134 #endif |
| 135 }; | 135 }; |
| 136 } | 136 } |
| 137 | 137 |
| 138 #endif | 138 #endif |
| OLD | NEW |