Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include/AdblockPlus/FilterEngine.h

Issue 29366747: Issue 4657 - Add Acceptable Ads API (Closed)
Patch Set: rebase and address comment Created April 5, 2017, 2:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/api.js » ('j') | test/FilterEngine.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2017 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 * subscription URL. 112 * subscription URL.
113 */ 113 */
114 void UpdateFilters(); 114 void UpdateFilters();
115 115
116 /** 116 /**
117 * Checks if the subscription is currently being updated. 117 * Checks if the subscription is currently being updated.
118 * @return `true` if the subscription is currently being updated. 118 * @return `true` if the subscription is currently being updated.
119 */ 119 */
120 bool IsUpdating() const; 120 bool IsUpdating() const;
121 121
122 /**
123 * Indicates whether the subscription is acceptable ads subscription.
124 * @return `true` if this subscription is acceptable ads subscription.
125 */
126 bool IsAA() const;
127
122 bool operator==(const Subscription& subscription) const; 128 bool operator==(const Subscription& subscription) const;
123 129
124 /** 130 /**
125 * Creates a wrapper for an existing JavaScript subscription object. 131 * Creates a wrapper for an existing JavaScript subscription object.
126 * Normally you shouldn't call this directly, but use 132 * Normally you shouldn't call this directly, but use
127 * FilterEngine::GetSubscription() instead. 133 * FilterEngine::GetSubscription() instead.
128 * @param value JavaScript subscription object. 134 * @param value JavaScript subscription object.
129 */ 135 */
130 Subscription(JsValue&& value); 136 Subscription(JsValue&& value);
131 }; 137 };
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 */ 306 */
301 std::vector<SubscriptionPtr> GetListedSubscriptions() const; 307 std::vector<SubscriptionPtr> GetListedSubscriptions() const;
302 308
303 /** 309 /**
304 * Retrieves all recommended subscriptions. 310 * Retrieves all recommended subscriptions.
305 * @return List of recommended subscriptions. 311 * @return List of recommended subscriptions.
306 */ 312 */
307 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; 313 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const;
308 314
309 /** 315 /**
316 * Ensures that Acceptable Ads subscription is enabled or disabled.
317 * @param enabled
318 * - if the value is `true`
319 * - ensure that the filter set includes an enabled AA subscription,
320 * adding it if needed and enabling it if disabled.
321 * - if the value is `false`
322 * - if an AA subscription is present, disable it.
323 * - if absent, do nothing.
324 */
325 void SetAAEnabled(bool enabled);
326
327 /**
328 * Checks whether Acceptable Ads subscription is enabled.
329 * @return `true` if acceptable ads subscription is present and enabled.
330 */
331 bool IsAAEnabled() const;
332
333 /**
334 * Retrieves the URL of Acceptable Ads subscription, what makes the URL
335 * available even if subscription is not add yet.
336 * @return Returns URL of Acceptable Ads.
337 */
338 std::string GetAAUrl() const;
339
340 /**
310 * Invokes the listener set via SetNotificationAvailableCallback() with the 341 * Invokes the listener set via SetNotificationAvailableCallback() with the
311 * next notification to be shown. 342 * next notification to be shown.
312 * @param url URL to match notifications to (optional). 343 * @param url URL to match notifications to (optional).
313 */ 344 */
314 void ShowNextNotification(const std::string& url = std::string()); 345 void ShowNextNotification(const std::string& url = std::string());
315 346
316 /** 347 /**
317 * Sets the callback invoked when a notification should be shown. 348 * Sets the callback invoked when a notification should be shown.
318 * @param callback Callback to invoke. 349 * @param callback Callback to invoke.
319 */ 350 */
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 const JsValueList& params); 542 const JsValueList& params);
512 FilterPtr GetWhitelistingFilter(const std::string& url, 543 FilterPtr GetWhitelistingFilter(const std::string& url,
513 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; 544 ContentTypeMask contentTypeMask, const std::string& documentUrl) const;
514 FilterPtr GetWhitelistingFilter(const std::string& url, 545 FilterPtr GetWhitelistingFilter(const std::string& url,
515 ContentTypeMask contentTypeMask, 546 ContentTypeMask contentTypeMask,
516 const std::vector<std::string>& documentUrls) const; 547 const std::vector<std::string>& documentUrls) const;
517 }; 548 };
518 } 549 }
519 550
520 #endif 551 #endif
OLDNEW
« no previous file with comments | « no previous file | lib/api.js » ('j') | test/FilterEngine.cpp » ('J')

Powered by Google App Engine
This is Rietveld