Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include/AdblockPlus/FilterEngine.h

Issue 10171027: Compile subscriptions.xml into the libadblockplus build and make itusable (Closed)
Patch Set: Created April 19, 2013, 7:59 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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/JsEngine.h>
8 #include <AdblockPlus/JsValue.h> 8 #include <AdblockPlus/JsValue.h>
9 9
10 #include "tr1_memory.h" 10 #include "tr1_memory.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 private: 96 private:
97 friend class FilterEngine; 97 friend class FilterEngine;
98 Subscription(FilterEngine& filterEngine, const std::string& url); 98 Subscription(FilterEngine& filterEngine, const std::string& url);
99 #else 99 #else
100 Subscription(JsValuePtr value); 100 Subscription(JsValuePtr value);
101 #endif 101 #endif
102 }; 102 };
103 103
104 typedef std::tr1::shared_ptr<Filter> FilterPtr; 104 typedef std::tr1::shared_ptr<Filter> FilterPtr;
105 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr; 105 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr;
106 typedef void (*SubscriptionsCallback)(const std::vector<SubscriptionPtr>&);
107 106
108 class FilterEngine 107 class FilterEngine
109 { 108 {
110 #if FILTER_ENGINE_STUBS 109 #if FILTER_ENGINE_STUBS
111 friend class Filter; 110 friend class Filter;
112 friend class Subscription; 111 friend class Subscription;
113 #endif 112 #endif
114 113
115 public: 114 public:
116 explicit FilterEngine(JsEnginePtr jsEngine); 115 explicit FilterEngine(JsEnginePtr jsEngine);
117 FilterPtr GetFilter(const std::string& text); 116 FilterPtr GetFilter(const std::string& text);
118 SubscriptionPtr GetSubscription(const std::string& url); 117 SubscriptionPtr GetSubscription(const std::string& url);
119 const std::vector<FilterPtr> GetListedFilters() const; 118 std::vector<FilterPtr> GetListedFilters() const;
120 const std::vector<SubscriptionPtr> GetListedSubscriptions() const; 119 std::vector<SubscriptionPtr> GetListedSubscriptions() const;
121 void FetchAvailableSubscriptions(SubscriptionsCallback callback); 120 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const;
122 FilterPtr Matches(const std::string& url, 121 FilterPtr Matches(const std::string& url,
123 const std::string& contentType, 122 const std::string& contentType,
124 const std::string& documentUrl); 123 const std::string& documentUrl);
125 std::vector<std::string> GetElementHidingSelectors(const std::string& domain ) const; 124 std::vector<std::string> GetElementHidingSelectors(const std::string& domain ) const;
126 125
127 private: 126 private:
128 JsEnginePtr jsEngine; 127 JsEnginePtr jsEngine;
129 #if FILTER_ENGINE_STUBS 128 #if FILTER_ENGINE_STUBS
130 std::map<std::string, FilterPtr> knownFilters; 129 std::map<std::string, FilterPtr> knownFilters;
131 std::vector<FilterPtr> listedFilters; 130 std::vector<FilterPtr> listedFilters;
132 std::map<std::string, SubscriptionPtr> knownSubscriptions; 131 std::map<std::string, SubscriptionPtr> knownSubscriptions;
133 std::vector<SubscriptionPtr> listedSubscriptions; 132 std::vector<SubscriptionPtr> listedSubscriptions;
134 #endif 133 #endif
135 }; 134 };
136 } 135 }
137 136
138 #endif 137 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld