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

Delta Between Two Patch Sets: include/AdblockPlus/FilterEngine.h

Issue 29317074: Issue 2693 - Update adblockplus dependency (Closed)
Left Patch Set: fix js event name Created June 22, 2015, 10:11 a.m.
Right Patch Set: rebase Created July 2, 2015, 1:37 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « ensure_dependencies.py ('k') | lib/api.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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&)> NotificationAvailab leCallback; 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 * Invokes the listener set via SetNotificationAvailableCallback() with the 256 * Invokes the listener set via SetNotificationAvailableCallback() with the
248 * next notification to be shown. 257 * next notification to be shown.
249 * @param url URL to match notifications to (optional). 258 * @param url URL to match notifications to (optional).
250 */ 259 */
251 void ShowNextNotification(const std::string& url = std::string()); 260 void ShowNextNotification(const std::string& url = std::string());
252 261
253 /** 262 /**
254 * Sets the callback invoked when a notification should be shown. 263 * Sets the callback invoked when a notification should be shown.
255 * @param callback Callback to invoke. 264 * @param callback Callback to invoke.
256 */ 265 */
257 void SetNotificationAvailableCallback(const NotificationAvailableCallback& v alue); 266 void SetShowNotificationCallback(const ShowNotificationCallback& value);
Felix Dahlke 2015/06/25 18:35:48 I'd prefer to call this SetNotificationShowCallbac
sergei 2015/06/26 14:21:17 I think the callback should be called `ShowNotific
Felix Dahlke 2015/06/30 19:45:31 Yeah, fair enough.
258 267
259 /** 268 /**
260 * Removes the callback invoked when a notification should be shown. 269 * Removes the callback invoked when a notification should be shown.
261 * available. 270 */
262 */ 271 void RemoveShowNotificationCallback();
263 void RemoveNotificationAvailableCallback();
264 272
265 /** 273 /**
266 * Checks if any active filter matches the supplied URL. 274 * Checks if any active filter matches the supplied URL.
267 * @param url URL to match. 275 * @param url URL to match.
268 * @param contentType Content type of the requested resource. 276 * @param contentType Content type of the requested resource.
269 * @param documentUrl URL of the document requesting the resource. 277 * @param documentUrl URL of the document requesting the resource.
270 * Note that there will be more than one document if frames are 278 * Note that there will be more than one document if frames are
271 * involved, see 279 * involved, see
272 * Matches(const std::string&, const std::string&, const std::vector< std::string>&) const. 280 * Matches(const std::string&, const std::string&, const std::vector< std::string>&) const.
273 * @return Matching filter, or `null` if there was no match. 281 * @return Matching filter, or `null` if there was no match.
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 static const std::map<ContentType, std::string> contentTypes; 404 static const std::map<ContentType, std::string> contentTypes;
397 405
398 void InitDone(JsValueList& params); 406 void InitDone(JsValueList& params);
399 FilterPtr CheckFilterMatch(const std::string& url, 407 FilterPtr CheckFilterMatch(const std::string& url,
400 ContentType contentType, 408 ContentType contentType,
401 const std::string& documentUrl) const; 409 const std::string& documentUrl) const;
402 void UpdateAvailable(UpdateAvailableCallback callback, JsValueList& params); 410 void UpdateAvailable(UpdateAvailableCallback callback, JsValueList& params);
403 void UpdateCheckDone(const std::string& eventName, 411 void UpdateCheckDone(const std::string& eventName,
404 UpdateCheckDoneCallback callback, JsValueList& params); 412 UpdateCheckDoneCallback callback, JsValueList& params);
405 void FilterChanged(FilterChangeCallback callback, JsValueList& params); 413 void FilterChanged(FilterChangeCallback callback, JsValueList& params);
406 void NotificationAvailable(const NotificationAvailableCallback& callback, 414 void ShowNotification(const ShowNotificationCallback& callback,
407 const JsValueList& params); 415 const JsValueList& params);
408 }; 416 };
409 } 417 }
410 418
411 #endif 419 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld