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-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 |
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 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #ifndef ADBLOCK_PLUS_FILTER_ENGINE_H | 18 #ifndef ADBLOCK_PLUS_FILTER_ENGINE_H |
19 #define ADBLOCK_PLUS_FILTER_ENGINE_H | 19 #define ADBLOCK_PLUS_FILTER_ENGINE_H |
20 | 20 |
21 #include <functional> | 21 #include <functional> |
22 #include <map> | 22 #include <map> |
23 #include <string> | 23 #include <string> |
24 #include <vector> | 24 #include <vector> |
25 #include <AdblockPlus/JsEngine.h> | 25 #include <AdblockPlus/JsEngine.h> |
26 #include <AdblockPlus/JsValue.h> | 26 #include <AdblockPlus/JsValue.h> |
| 27 #include <AdblockPlus/Notification.h> |
27 | 28 |
28 #include "tr1_memory.h" | 29 #include "tr1_memory.h" |
29 | 30 |
30 namespace AdblockPlus | 31 namespace AdblockPlus |
31 { | 32 { |
32 class FilterEngine; | 33 class FilterEngine; |
33 | 34 |
34 /** | 35 /** |
35 * Wrapper for an Adblock Plus filter object. | 36 * Wrapper for an Adblock Plus filter object. |
36 * There are no accessors for most | 37 * There are no accessors for most |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 */ | 231 */ |
231 std::vector<SubscriptionPtr> GetListedSubscriptions() const; | 232 std::vector<SubscriptionPtr> GetListedSubscriptions() const; |
232 | 233 |
233 /** | 234 /** |
234 * Retrieves all recommended subscriptions. | 235 * Retrieves all recommended subscriptions. |
235 * @return List of recommended subscriptions. | 236 * @return List of recommended subscriptions. |
236 */ | 237 */ |
237 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; | 238 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; |
238 | 239 |
239 /** | 240 /** |
| 241 * Creates new Notification(see `Notification`) object. |
| 242 * @param type Type of the notification. |
| 243 * @param id Id of the newly created notification. |
| 244 * @return New Notification instance. |
| 245 */ |
| 246 std::tr1::shared_ptr<Notification> CreateNotification(NotificationType type, |
| 247 const std::string& id) const; |
| 248 |
| 249 /** |
| 250 * Determines which notification is to be shown next. |
| 251 * @param url URL to match notifications to (optional). |
| 252 * @return Notification to be shown, or null if there is no any. |
| 253 */ |
| 254 std::tr1::shared_ptr<Notification> GetNextNotificationToShow( |
| 255 const std::string& url = std::string()); |
| 256 |
| 257 /** |
| 258 * Adds a local notification. |
| 259 * @param value The notification to add |
| 260 */ |
| 261 void AddNotification(const std::tr1::shared_ptr<Notification>& value); |
| 262 |
| 263 /** |
| 264 * Removes an existing local notification. |
| 265 * @param notification The notification to remove. |
| 266 */ |
| 267 void RemoveNotification(const std::tr1::shared_ptr<Notification>& value); |
| 268 |
| 269 /** |
| 270 * Marks the notification as shown. |
| 271 * @param notificationId The notification ID. |
| 272 */ |
| 273 void MarkNotificationAsShown(const std::string& notificationId); |
| 274 |
| 275 /** |
240 * Checks if any active filter matches the supplied URL. | 276 * Checks if any active filter matches the supplied URL. |
241 * @param url URL to match. | 277 * @param url URL to match. |
242 * @param contentType Content type of the requested resource. | 278 * @param contentType Content type of the requested resource. |
243 * @param documentUrl URL of the document requesting the resource. | 279 * @param documentUrl URL of the document requesting the resource. |
244 * Note that there will be more than one document if frames are | 280 * Note that there will be more than one document if frames are |
245 * involved, see | 281 * involved, see |
246 * Matches(const std::string&, const std::string&, const std::vector<
std::string>&) const. | 282 * Matches(const std::string&, const std::string&, const std::vector<
std::string>&) const. |
247 * @return Matching filter, or `null` if there was no match. | 283 * @return Matching filter, or `null` if there was no match. |
248 * @throw `std::invalid_argument`, if an invalid `contentType` was supplied. | 284 * @throw `std::invalid_argument`, if an invalid `contentType` was supplied. |
249 */ | 285 */ |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 ContentType contentType, | 410 ContentType contentType, |
375 const std::string& documentUrl) const; | 411 const std::string& documentUrl) const; |
376 void UpdateAvailable(UpdateAvailableCallback callback, JsValueList& params); | 412 void UpdateAvailable(UpdateAvailableCallback callback, JsValueList& params); |
377 void UpdateCheckDone(const std::string& eventName, | 413 void UpdateCheckDone(const std::string& eventName, |
378 UpdateCheckDoneCallback callback, JsValueList& params); | 414 UpdateCheckDoneCallback callback, JsValueList& params); |
379 void FilterChanged(FilterChangeCallback callback, JsValueList& params); | 415 void FilterChanged(FilterChangeCallback callback, JsValueList& params); |
380 }; | 416 }; |
381 } | 417 } |
382 | 418 |
383 #endif | 419 #endif |
OLD | NEW |