| OLD | NEW |
| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-present 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| (...skipping 30 matching lines...) Expand all Loading... |
| 44 Filter(const Filter& src); | 44 Filter(const Filter& src); |
| 45 Filter(Filter&& src); | 45 Filter(Filter&& src); |
| 46 Filter& operator=(const Filter& src); | 46 Filter& operator=(const Filter& src); |
| 47 Filter& operator=(Filter&& src); | 47 Filter& operator=(Filter&& src); |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Filter types, see https://adblockplus.org/en/filters. | 50 * Filter types, see https://adblockplus.org/en/filters. |
| 51 */ | 51 */ |
| 52 enum Type {TYPE_BLOCKING, TYPE_EXCEPTION, | 52 enum Type {TYPE_BLOCKING, TYPE_EXCEPTION, |
| 53 TYPE_ELEMHIDE, TYPE_ELEMHIDE_EXCEPTION, | 53 TYPE_ELEMHIDE, TYPE_ELEMHIDE_EXCEPTION, |
| 54 TYPE_TYPE_ELEMHIDE_EMULATION, |
| 54 TYPE_COMMENT, TYPE_INVALID}; | 55 TYPE_COMMENT, TYPE_INVALID}; |
| 55 | 56 |
| 56 /** | 57 /** |
| 57 * Retrieves the type of this filter. | 58 * Retrieves the type of this filter. |
| 58 * @return Type of this filter. | 59 * @return Type of this filter. |
| 59 */ | 60 */ |
| 60 Type GetType() const; | 61 Type GetType() const; |
| 61 | 62 |
| 62 /** | 63 /** |
| 63 * Checks whether this filter has been added to the list of custom filters. | 64 * Checks whether this filter has been added to the list of custom filters. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 */ | 199 */ |
| 199 enum ContentType | 200 enum ContentType |
| 200 { | 201 { |
| 201 CONTENT_TYPE_OTHER = 1, | 202 CONTENT_TYPE_OTHER = 1, |
| 202 CONTENT_TYPE_SCRIPT = 2, | 203 CONTENT_TYPE_SCRIPT = 2, |
| 203 CONTENT_TYPE_IMAGE = 4, | 204 CONTENT_TYPE_IMAGE = 4, |
| 204 CONTENT_TYPE_STYLESHEET = 8, | 205 CONTENT_TYPE_STYLESHEET = 8, |
| 205 CONTENT_TYPE_OBJECT = 16, | 206 CONTENT_TYPE_OBJECT = 16, |
| 206 CONTENT_TYPE_SUBDOCUMENT = 32, | 207 CONTENT_TYPE_SUBDOCUMENT = 32, |
| 207 CONTENT_TYPE_DOCUMENT = 64, | 208 CONTENT_TYPE_DOCUMENT = 64, |
| 209 CONTENT_TYPE_WEBSOCKET = 128, |
| 210 CONTENT_TYPE_WEBRTC = 256, |
| 208 CONTENT_TYPE_PING = 1024, | 211 CONTENT_TYPE_PING = 1024, |
| 209 CONTENT_TYPE_XMLHTTPREQUEST = 2048, | 212 CONTENT_TYPE_XMLHTTPREQUEST = 2048, |
| 210 CONTENT_TYPE_OBJECT_SUBREQUEST = 4096, | 213 CONTENT_TYPE_OBJECT_SUBREQUEST = 4096, |
| 211 CONTENT_TYPE_MEDIA = 16384, | 214 CONTENT_TYPE_MEDIA = 16384, |
| 212 CONTENT_TYPE_FONT = 32768, | 215 CONTENT_TYPE_FONT = 32768, |
| 213 CONTENT_TYPE_GENERICBLOCK = 0x20000000, | 216 CONTENT_TYPE_GENERICBLOCK = 0x20000000, |
| 214 CONTENT_TYPE_ELEMHIDE = 0x40000000, | 217 CONTENT_TYPE_ELEMHIDE = 0x40000000, |
| 215 CONTENT_TYPE_GENERICHIDE = 0x80000000 | 218 CONTENT_TYPE_GENERICHIDE = 0x80000000 |
| 216 }; | 219 }; |
| 217 | 220 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 Prefs preconfiguredPrefs; | 276 Prefs preconfiguredPrefs; |
| 274 /** | 277 /** |
| 275 * A callback of `AdblockPlus::FilterEngine::IsConnectionAllowedAsyncCallb
ack` type | 278 * A callback of `AdblockPlus::FilterEngine::IsConnectionAllowedAsyncCallb
ack` type |
| 276 * checking whether the request to download a subscription from Adblock Pl
us may be performed | 279 * checking whether the request to download a subscription from Adblock Pl
us may be performed |
| 277 * on the current connection. | 280 * on the current connection. |
| 278 */ | 281 */ |
| 279 IsConnectionAllowedAsyncCallback isSubscriptionDownloadAllowedCallback; | 282 IsConnectionAllowedAsyncCallback isSubscriptionDownloadAllowedCallback; |
| 280 }; | 283 }; |
| 281 | 284 |
| 282 /** | 285 /** |
| 283 * Callback type invoked when FilterEngine is created. | 286 * Callback type invoked when FilterEngine is created. |
| 284 */ | 287 */ |
| 285 typedef std::function<void(const FilterEnginePtr&)> OnCreatedCallback; | 288 typedef std::function<void(const FilterEnginePtr&)> OnCreatedCallback; |
| 286 | 289 |
| 287 /** | 290 /** |
| 288 * Asynchronously constructs FilterEngine. | 291 * Asynchronously constructs FilterEngine. |
| 289 * @param jsEngine `JsEngine` instance used to run JavaScript code | 292 * @param jsEngine `JsEngine` instance used to run JavaScript code |
| 290 * internally. | 293 * internally. |
| 291 * @param onCreated A callback which is called when FilterEngine is ready | 294 * @param onCreated A callback which is called when FilterEngine is ready |
| 292 * for use. | 295 * for use. |
| 293 * @param parameters optional creation parameters. | 296 * @param parameters optional creation parameters. |
| 294 */ | 297 */ |
| 295 static void CreateAsync(const JsEnginePtr& jsEngine, | 298 static void CreateAsync(const JsEnginePtr& jsEngine, |
| 296 const OnCreatedCallback& onCreated, | 299 const OnCreatedCallback& onCreated, |
| 297 const CreationParameters& parameters = CreationParameters()); | 300 const CreationParameters& parameters = CreationParameters()); |
| 298 | 301 |
| 299 /** | 302 /** |
| 300 * Synchronous interface to construct FilterEngine. For details see | |
| 301 * asynchronous version CreateAsync. | |
| 302 */ | |
| 303 static FilterEnginePtr Create(const JsEnginePtr& jsEngine, | |
| 304 const CreationParameters& params = CreationParameters()); | |
| 305 | |
| 306 /** | |
| 307 * Retrieves the `JsEngine` instance associated with this `FilterEngine` | 303 * Retrieves the `JsEngine` instance associated with this `FilterEngine` |
| 308 * instance. | 304 * instance. |
| 309 */ | 305 */ |
| 310 JsEnginePtr GetJsEngine() const { return jsEngine; } | 306 JsEngine& GetJsEngine() const { return *jsEngine; } |
| 311 | 307 |
| 312 /** | 308 /** |
| 313 * Checks if this is the first run of the application. | 309 * Checks if this is the first run of the application. |
| 314 * @return `true` if the application is running for the first time. | 310 * @return `true` if the application is running for the first time. |
| 315 */ | 311 */ |
| 316 bool IsFirstRun() const; | 312 bool IsFirstRun() const; |
| 317 | 313 |
| 318 /** | 314 /** |
| 319 * Retrieves a filter object from its text representation. | 315 * Retrieves a filter object from its text representation. |
| 320 * @param text Text representation of the filter, | 316 * @param text Text representation of the filter, |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 void FilterChanged(const FilterChangeCallback& callback, JsValueList&& param
s) const; | 569 void FilterChanged(const FilterChangeCallback& callback, JsValueList&& param
s) const; |
| 574 FilterPtr GetWhitelistingFilter(const std::string& url, | 570 FilterPtr GetWhitelistingFilter(const std::string& url, |
| 575 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; | 571 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; |
| 576 FilterPtr GetWhitelistingFilter(const std::string& url, | 572 FilterPtr GetWhitelistingFilter(const std::string& url, |
| 577 ContentTypeMask contentTypeMask, | 573 ContentTypeMask contentTypeMask, |
| 578 const std::vector<std::string>& documentUrls) const; | 574 const std::vector<std::string>& documentUrls) const; |
| 579 }; | 575 }; |
| 580 } | 576 } |
| 581 | 577 |
| 582 #endif | 578 #endif |
| OLD | NEW |