LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 /** | 179 /** |
180 * Callback type invoked when the filters change. | 180 * Callback type invoked when the filters change. |
181 * The first parameter is the action event code (see | 181 * The first parameter is the action event code (see |
182 * [FilterNotifier.triggerListeners](https://adblockplus.org/jsdoc/adblockpl
us/symbols/FilterNotifier.html#.triggerListeners) | 182 * [FilterNotifier.triggerListeners](https://adblockplus.org/jsdoc/adblockpl
us/symbols/FilterNotifier.html#.triggerListeners) |
183 * for the full list). | 183 * for the full list). |
184 * The second parameter is the filter/subscription object affected, if any. | 184 * The second parameter is the filter/subscription object affected, if any. |
185 */ | 185 */ |
186 typedef std::tr1::function<void(const std::string&, const JsValuePtr)> Filte
rChangeCallback; | 186 typedef std::tr1::function<void(const std::string&, const JsValuePtr)> Filte
rChangeCallback; |
187 | 187 |
188 /** | 188 /** |
| 189 * Container of name-value pairs representing a set of preferences. |
| 190 */ |
| 191 typedef std::map<std::string, AdblockPlus::JsValuePtr> Prefs; |
| 192 |
| 193 /** |
189 * Callback type invoked when a new notification should be shown. | 194 * Callback type invoked when a new notification should be shown. |
190 * The parameter is the Notification object to be shown. | 195 * The parameter is the Notification object to be shown. |
191 */ | 196 */ |
192 typedef std::tr1::function<void(const NotificationPtr&)> ShowNotificationCal
lback; | 197 typedef std::tr1::function<void(const NotificationPtr&)> ShowNotificationCal
lback; |
193 | 198 |
194 /** | 199 /** |
195 * Constructor. | 200 * Constructor. |
196 * @param jsEngine `JsEngine` instance used to run JavaScript code | 201 * @param jsEngine `JsEngine` instance used to run JavaScript code |
197 * internally. | 202 * internally. |
198 */ | 203 * @param preconfiguredPrefs `AdblockPlus::FilterEngine::Prefs` |
199 explicit FilterEngine(JsEnginePtr jsEngine); | 204 * name-value list of preconfigured prefs. |
| 205 */ |
| 206 explicit FilterEngine(JsEnginePtr jsEngine, |
| 207 const Prefs& preconfiguredPrefs = Prefs() |
| 208 ); |
200 | 209 |
201 /** | 210 /** |
202 * Retrieves the `JsEngine` instance associated with this `FilterEngine` | 211 * Retrieves the `JsEngine` instance associated with this `FilterEngine` |
203 * instance. | 212 * instance. |
204 */ | 213 */ |
205 JsEnginePtr GetJsEngine() const { return jsEngine; } | 214 JsEnginePtr GetJsEngine() const { return jsEngine; } |
206 | 215 |
207 /** | 216 /** |
208 * Checks if this is the first run of the application. | 217 * Checks if this is the first run of the application. |
209 * @return `true` if the application is running for the first time. | 218 * @return `true` if the application is running for the first time. |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 void UpdateAvailable(UpdateAvailableCallback callback, JsValueList& params); | 410 void UpdateAvailable(UpdateAvailableCallback callback, JsValueList& params); |
402 void UpdateCheckDone(const std::string& eventName, | 411 void UpdateCheckDone(const std::string& eventName, |
403 UpdateCheckDoneCallback callback, JsValueList& params); | 412 UpdateCheckDoneCallback callback, JsValueList& params); |
404 void FilterChanged(FilterChangeCallback callback, JsValueList& params); | 413 void FilterChanged(FilterChangeCallback callback, JsValueList& params); |
405 void ShowNotification(const ShowNotificationCallback& callback, | 414 void ShowNotification(const ShowNotificationCallback& callback, |
406 const JsValueList& params); | 415 const JsValueList& params); |
407 }; | 416 }; |
408 } | 417 } |
409 | 418 |
410 #endif | 419 #endif |
LEFT | RIGHT |