Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 Subscription(JsValuePtr value); | 62 Subscription(JsValuePtr value); |
63 }; | 63 }; |
64 | 64 |
65 typedef std::tr1::shared_ptr<Filter> FilterPtr; | 65 typedef std::tr1::shared_ptr<Filter> FilterPtr; |
66 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr; | 66 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr; |
67 | 67 |
68 class FilterEngine | 68 class FilterEngine |
69 { | 69 { |
70 public: | 70 public: |
71 typedef std::tr1::function<void(const std::string&)> UpdaterCallback; | 71 typedef std::tr1::function<void(const std::string&)> UpdaterCallback; |
72 typedef std::tr1::function<void(const std::string&, const std::string&, cons t int64_t)> FilterChangeCallback; | |
Wladimir Palant
2013/06/18 15:02:15
int64_t doesn't need to be const.
Felix Dahlke
2013/06/19 10:28:38
It's a matter of taste here. I like to const every
Wladimir Palant
2013/06/19 11:27:09
This essentially disallows the callback to change
Felix Dahlke
2013/06/19 11:35:34
That's the trouble with const parameters, have to
| |
72 | 73 |
73 explicit FilterEngine(JsEnginePtr jsEngine); | 74 explicit FilterEngine(JsEnginePtr jsEngine); |
74 JsEnginePtr GetJsEngine() const { return jsEngine; } | 75 JsEnginePtr GetJsEngine() const { return jsEngine; } |
75 bool IsFirstRun() const; | 76 bool IsFirstRun() const; |
76 FilterPtr GetFilter(const std::string& text); | 77 FilterPtr GetFilter(const std::string& text); |
77 SubscriptionPtr GetSubscription(const std::string& url); | 78 SubscriptionPtr GetSubscription(const std::string& url); |
78 std::vector<FilterPtr> GetListedFilters() const; | 79 std::vector<FilterPtr> GetListedFilters() const; |
79 std::vector<SubscriptionPtr> GetListedSubscriptions() const; | 80 std::vector<SubscriptionPtr> GetListedSubscriptions() const; |
80 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; | 81 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; |
81 FilterPtr Matches(const std::string& url, | 82 FilterPtr Matches(const std::string& url, |
82 const std::string& contentType, | 83 const std::string& contentType, |
83 const std::string& documentUrl) const; | 84 const std::string& documentUrl) const; |
84 std::vector<std::string> GetElementHidingSelectors(const std::string& domain ) const; | 85 std::vector<std::string> GetElementHidingSelectors(const std::string& domain ) const; |
85 JsValuePtr GetPref(const std::string& pref) const; | 86 JsValuePtr GetPref(const std::string& pref) const; |
86 void SetPref(const std::string& pref, JsValuePtr value); | 87 void SetPref(const std::string& pref, JsValuePtr value); |
87 void ForceUpdateCheck(UpdaterCallback callback = 0); | 88 void ForceUpdateCheck(UpdaterCallback callback = 0); |
89 void SetFilterChangeCallback(FilterChangeCallback callback = 0); | |
Wladimir Palant
2013/06/18 15:02:15
Having a default for the callback makes no sense -
| |
88 | 90 |
89 private: | 91 private: |
90 JsEnginePtr jsEngine; | 92 JsEnginePtr jsEngine; |
91 bool initialized; | 93 bool initialized; |
92 bool firstRun; | 94 bool firstRun; |
93 int updateCheckId; | 95 int updateCheckId; |
94 | 96 |
95 void InitDone(JsValueList& params); | 97 void InitDone(JsValueList& params); |
96 void UpdateCheckDone(const std::string& eventName, UpdaterCallback callback, JsValueList& params); | 98 void UpdateCheckDone(const std::string& eventName, UpdaterCallback callback, JsValueList& params); |
99 void FilterChanged(const std::string& eventName, FilterChangeCallback callba ck, JsValueList& params); | |
97 }; | 100 }; |
98 } | 101 } |
99 | 102 |
100 #endif | 103 #endif |
OLD | NEW |