Left: | ||
Right: |
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 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 } | 258 } |
259 | 259 |
260 NotificationPtr FilterEngine::GetNextNotificationToShow(const std::string& url) | 260 NotificationPtr FilterEngine::GetNextNotificationToShow(const std::string& url) |
261 { | 261 { |
262 JsValuePtr func = jsEngine->Evaluate("API.getNextNotificationToShow"); | 262 JsValuePtr func = jsEngine->Evaluate("API.getNextNotificationToShow"); |
263 JsValueList params; | 263 JsValueList params; |
264 if (!url.empty()) | 264 if (!url.empty()) |
265 { | 265 { |
266 params.push_back(jsEngine->NewValue(url)); | 266 params.push_back(jsEngine->NewValue(url)); |
267 } | 267 } |
268 return Notification::JsValueToNotification(func->Call(params)); | 268 auto jsNotification = func->Call(params); |
Felix Dahlke
2015/01/27 13:09:09
C++03! :)
sergei
2015/01/27 13:20:12
fixed, sorry
| |
269 if (!jsNotification->IsObject()) | |
270 { | |
271 return NotificationPtr(); | |
272 } | |
273 return NotificationPtr(new Notification(jsNotification)); | |
269 } | 274 } |
270 | 275 |
271 AdblockPlus::FilterPtr FilterEngine::Matches(const std::string& url, | 276 AdblockPlus::FilterPtr FilterEngine::Matches(const std::string& url, |
272 ContentType contentType, | 277 ContentType contentType, |
273 const std::string& documentUrl) const | 278 const std::string& documentUrl) const |
274 { | 279 { |
275 std::vector<std::string> documentUrls; | 280 std::vector<std::string> documentUrls; |
276 documentUrls.push_back(documentUrl); | 281 documentUrls.push_back(documentUrl); |
277 return Matches(url, contentType, documentUrls); | 282 return Matches(url, contentType, documentUrls); |
278 } | 283 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
415 } | 420 } |
416 | 421 |
417 int FilterEngine::CompareVersions(const std::string& v1, const std::string& v2) | 422 int FilterEngine::CompareVersions(const std::string& v1, const std::string& v2) |
418 { | 423 { |
419 JsValueList params; | 424 JsValueList params; |
420 params.push_back(jsEngine->NewValue(v1)); | 425 params.push_back(jsEngine->NewValue(v1)); |
421 params.push_back(jsEngine->NewValue(v2)); | 426 params.push_back(jsEngine->NewValue(v2)); |
422 JsValuePtr func = jsEngine->Evaluate("API.compareVersions"); | 427 JsValuePtr func = jsEngine->Evaluate("API.compareVersions"); |
423 return func->Call(params)->AsInt(); | 428 return func->Call(params)->AsInt(); |
424 } | 429 } |
OLD | NEW |