Index: include/AdblockPlus/FilterEngine.h |
=================================================================== |
--- a/include/AdblockPlus/FilterEngine.h |
+++ b/include/AdblockPlus/FilterEngine.h |
@@ -13,19 +13,20 @@ |
* |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
#ifndef ADBLOCK_PLUS_FILTER_ENGINE_H |
#define ADBLOCK_PLUS_FILTER_ENGINE_H |
-#include <vector> |
+#include <functional> |
#include <map> |
#include <string> |
+#include <vector> |
#include <AdblockPlus/JsEngine.h> |
#include <AdblockPlus/JsValue.h> |
#include "tr1_memory.h" |
namespace AdblockPlus |
{ |
class FilterEngine; |
@@ -62,33 +63,38 @@ namespace AdblockPlus |
}; |
typedef std::tr1::shared_ptr<Filter> FilterPtr; |
typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr; |
class FilterEngine |
{ |
public: |
+ typedef std::function<void(const std::string&)> UpdaterCallback; |
+ |
explicit FilterEngine(JsEnginePtr jsEngine); |
JsEnginePtr GetJsEngine() const { return jsEngine; } |
bool IsFirstRun() const; |
FilterPtr GetFilter(const std::string& text); |
SubscriptionPtr GetSubscription(const std::string& url); |
std::vector<FilterPtr> GetListedFilters() const; |
std::vector<SubscriptionPtr> GetListedSubscriptions() const; |
std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; |
FilterPtr Matches(const std::string& url, |
const std::string& contentType, |
const std::string& documentUrl) const; |
std::vector<std::string> GetElementHidingSelectors(const std::string& domain) const; |
JsValuePtr GetPref(const std::string& pref) const; |
void SetPref(const std::string& pref, JsValuePtr value); |
+ void ForceUpdateCheck(UpdaterCallback callback = 0); |
private: |
JsEnginePtr jsEngine; |
bool initialized; |
bool firstRun; |
+ int updateCheckId; |
void InitDone(JsValueList& params); |
+ void UpdateCheckDone(const std::string& eventName, UpdaterCallback callback, JsValueList& params); |
}; |
} |
#endif |