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

Side by Side Diff: src/FilterEngine.cpp

Issue 29408747: Issue 5013 - Mark more method as const (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 10, 2017, 3:08 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
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 bool FilterEngine::IsAAEnabled() const 326 bool FilterEngine::IsAAEnabled() const
327 { 327 {
328 return jsEngine->Evaluate("API.isAASubscriptionEnabled()")->AsBool(); 328 return jsEngine->Evaluate("API.isAASubscriptionEnabled()")->AsBool();
329 } 329 }
330 330
331 std::string FilterEngine::GetAAUrl() const 331 std::string FilterEngine::GetAAUrl() const
332 { 332 {
333 return GetPref("subscriptions_exceptionsurl")->AsString(); 333 return GetPref("subscriptions_exceptionsurl")->AsString();
334 } 334 }
335 335
336 void FilterEngine::ShowNextNotification(const std::string& url) 336 void FilterEngine::ShowNextNotification(const std::string& url) const
337 { 337 {
338 JsValuePtr func = jsEngine->Evaluate("API.showNextNotification"); 338 JsValuePtr func = jsEngine->Evaluate("API.showNextNotification");
339 JsConstValueList params; 339 JsConstValueList params;
340 if (!url.empty()) 340 if (!url.empty())
341 { 341 {
342 params.push_back(jsEngine->NewValue(url)); 342 params.push_back(jsEngine->NewValue(url));
343 } 343 }
344 func->Call(params); 344 func->Call(params);
345 } 345 }
346 346
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 std::bind(&FilterEngine::UpdateAvailable, this, callback, 455 std::bind(&FilterEngine::UpdateAvailable, this, callback,
456 std::placeholders::_1)); 456 std::placeholders::_1));
457 } 457 }
458 458
459 void FilterEngine::RemoveUpdateAvailableCallback() 459 void FilterEngine::RemoveUpdateAvailableCallback()
460 { 460 {
461 jsEngine->RemoveEventCallback("updateAvailable"); 461 jsEngine->RemoveEventCallback("updateAvailable");
462 } 462 }
463 463
464 void FilterEngine::UpdateAvailable( 464 void FilterEngine::UpdateAvailable(
465 FilterEngine::UpdateAvailableCallback callback, JsValueList& params) 465 FilterEngine::UpdateAvailableCallback callback, JsValueList& params) const
466 { 466 {
467 if (params.size() >= 1 && !params[0]->IsNull()) 467 if (params.size() >= 1 && !params[0]->IsNull())
468 callback(params[0]->AsString()); 468 callback(params[0]->AsString());
469 } 469 }
470 470
471 void FilterEngine::ForceUpdateCheck( 471 void FilterEngine::ForceUpdateCheck(
472 const FilterEngine::UpdateCheckDoneCallback& callback) 472 const FilterEngine::UpdateCheckDoneCallback& callback)
473 { 473 {
474 JsValuePtr func = jsEngine->Evaluate("API.forceUpdateCheck"); 474 JsValuePtr func = jsEngine->Evaluate("API.forceUpdateCheck");
475 JsConstValueList params; 475 JsConstValueList params;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 509 }
510 510
511 std::unique_ptr<std::string> FilterEngine::GetAllowedConnectionType() const 511 std::unique_ptr<std::string> FilterEngine::GetAllowedConnectionType() const
512 { 512 {
513 auto prefValue = GetPref("allowed_connection_type"); 513 auto prefValue = GetPref("allowed_connection_type");
514 if (prefValue->AsString().empty()) 514 if (prefValue->AsString().empty())
515 return nullptr; 515 return nullptr;
516 return std::unique_ptr<std::string>(new std::string(prefValue->AsString())); 516 return std::unique_ptr<std::string>(new std::string(prefValue->AsString()));
517 } 517 }
518 518
519 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js ValueList& params) 519 void FilterEngine::FilterChanged(FilterEngine::FilterChangeCallback callback, Js ValueList& params) const
520 { 520 {
521 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS tring() : ""); 521 std::string action(params.size() >= 1 && !params[0]->IsNull() ? params[0]->AsS tring() : "");
522 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false)); 522 JsValuePtr item(params.size() >= 2 ? params[1] : jsEngine->NewValue(false));
523 callback(action, item); 523 callback(action, item);
524 } 524 }
525 525
526 void FilterEngine::ShowNotification(const ShowNotificationCallback& callback, 526 void FilterEngine::ShowNotification(const ShowNotificationCallback& callback,
527 const JsValueList& params) 527 const JsValueList& params) const
528 { 528 {
529 if (params.size() < 1) 529 if (params.size() < 1)
530 return; 530 return;
531 531
532 if (!params[0]->IsObject()) 532 if (!params[0]->IsObject())
533 { 533 {
534 return; 534 return;
535 } 535 }
536 callback(NotificationPtr(new Notification(std::move(*params[0])))); 536 callback(NotificationPtr(new Notification(std::move(*params[0]))));
537 } 537 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url); 574 FilterPtr filter = GetWhitelistingFilter(currentUrl, contentTypeMask, parent Url);
575 if (filter) 575 if (filter)
576 { 576 {
577 return filter; 577 return filter;
578 } 578 }
579 currentUrl = parentUrl; 579 currentUrl = parentUrl;
580 } 580 }
581 while (urlIterator != documentUrls.end()); 581 while (urlIterator != documentUrls.end());
582 return FilterPtr(); 582 return FilterPtr();
583 } 583 }
OLDNEW

Powered by Google App Engine
This is Rietveld