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

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

Issue 29377570: Issue 4931 - add possibility to not send data depending on connection properties (Closed)
Left Patch Set: Created Feb. 28, 2017, 10:21 p.m.
Right Patch Set: rebase Created March 16, 2017, 4:02 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 | « README.md ('k') | include/AdblockPlus/JsEngine.h » ('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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 /** 216 /**
217 * Callback function returning false when current connection is not 217 * Callback function returning false when current connection is not
218 * allowedConnectionType, e.g. because it is a metered connection. 218 * allowedConnectionType, e.g. because it is a metered connection.
219 */ 219 */
220 typedef std::function<bool(const std::string* allowedConnectionType)> IsConn ectionAllowedCallback; 220 typedef std::function<bool(const std::string* allowedConnectionType)> IsConn ectionAllowedCallback;
221 221
222 /** 222 /**
223 * FilterEngine creation parameters. 223 * FilterEngine creation parameters.
224 */ 224 */
225 struct CreateParameters 225 struct CreationParameters
226 { 226 {
227 /** 227 /**
228 * `AdblockPlus::FilterEngine::Prefs` name - value list of preconfigured 228 * `AdblockPlus::FilterEngine::Prefs` name - value list of preconfigured
229 * prefs. 229 * prefs.
230 */ 230 */
231 Prefs preconfiguredPrefs; 231 Prefs preconfiguredPrefs;
232 /** 232 /**
233 * `AdblockPlus::FilterEngine::IsConnectionAllowedCallback` a callback 233 * `AdblockPlus::FilterEngine::IsConnectionAllowedCallback` a callback
234 * checking whether the request from Adblock Plus should be blocked on 234 * checking whether the request from Adblock Plus should be blocked on
235 * the current connection. 235 * the current connection.
236 */ 236 */
237 IsConnectionAllowedCallback isConnectionAllowed; 237 IsConnectionAllowedCallback isConnectionAllowedCallback;
238 }; 238 };
239 239
240 /** 240 /**
241 * Callback type invoked when FilterEngine is created. 241 * Callback type invoked when FilterEngine is created.
242 */ 242 */
243 typedef std::function<void(const FilterEnginePtr&)> OnCreatedCallback; 243 typedef std::function<void(const FilterEnginePtr&)> OnCreatedCallback;
244 244
245 /** 245 /**
246 * Asynchronously constructs FilterEngine. 246 * Asynchronously constructs FilterEngine.
247 * @param jsEngine `JsEngine` instance used to run JavaScript code 247 * @param jsEngine `JsEngine` instance used to run JavaScript code
248 * internally. 248 * internally.
249 * @param onCreated A callback which is called when FilterEngine is ready 249 * @param onCreated A callback which is called when FilterEngine is ready
250 * for use. 250 * for use.
251 * @param parameters optional creation parameters. 251 * @param parameters optional creation parameters.
252 */ 252 */
253 static void CreateAsync(const JsEnginePtr& jsEngine, 253 static void CreateAsync(const JsEnginePtr& jsEngine,
254 const OnCreatedCallback& onCreated, 254 const OnCreatedCallback& onCreated,
255 const CreateParameters& parameters = CreateParameters()); 255 const CreationParameters& parameters = CreationParameters());
256 256
257 /** 257 /**
258 * Synchronous interface to construct FilterEngine. For details see 258 * Synchronous interface to construct FilterEngine. For details see
259 * asynchronous version CreateAsync. 259 * asynchronous version CreateAsync.
260 */ 260 */
261 static FilterEnginePtr Create(const JsEnginePtr& jsEngine, 261 static FilterEnginePtr Create(const JsEnginePtr& jsEngine,
262 const CreateParameters& params = CreateParameters()); 262 const CreationParameters& params = CreationParameters());
263 263
264 /** 264 /**
265 * Retrieves the `JsEngine` instance associated with this `FilterEngine` 265 * Retrieves the `JsEngine` instance associated with this `FilterEngine`
266 * instance. 266 * instance.
267 */ 267 */
268 JsEnginePtr GetJsEngine() const { return jsEngine; } 268 JsEnginePtr GetJsEngine() const { return jsEngine; }
269 269
270 /** 270 /**
271 * Checks if this is the first run of the application. 271 * Checks if this is the first run of the application.
272 * @return `true` if the application is running for the first time. 272 * @return `true` if the application is running for the first time.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 const JsValueList& params); 511 const JsValueList& params);
512 FilterPtr GetWhitelistingFilter(const std::string& url, 512 FilterPtr GetWhitelistingFilter(const std::string& url,
513 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; 513 ContentTypeMask contentTypeMask, const std::string& documentUrl) const;
514 FilterPtr GetWhitelistingFilter(const std::string& url, 514 FilterPtr GetWhitelistingFilter(const std::string& url,
515 ContentTypeMask contentTypeMask, 515 ContentTypeMask contentTypeMask,
516 const std::vector<std::string>& documentUrls) const; 516 const std::vector<std::string>& documentUrls) const;
517 }; 517 };
518 } 518 }
519 519
520 #endif 520 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld