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-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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 CPluginDebug::DebugResultHiding(tag, L"-", ToWstring(tagIt->second.m_f
ilterText)); | 598 CPluginDebug::DebugResultHiding(tag, L"-", ToWstring(tagIt->second.m_f
ilterText)); |
599 #endif | 599 #endif |
600 return true; | 600 return true; |
601 } | 601 } |
602 } | 602 } |
603 } | 603 } |
604 | 604 |
605 return false; | 605 return false; |
606 } | 606 } |
607 | 607 |
608 bool CPluginFilter::LoadHideFilters(std::vector<std::wstring> filters) | 608 bool CPluginFilter::LoadHideFilters(const std::vector<std::wstring>& filters) |
609 { | 609 { |
610 ClearFilters(); | 610 ClearFilters(); |
| 611 m_hideFilters = filters; |
611 bool isRead = false; | 612 bool isRead = false; |
612 CPluginClient* client = CPluginClient::GetInstance(); | 613 CPluginClient* client = CPluginClient::GetInstance(); |
613 | 614 |
614 // Parse hide string | 615 // Parse hide string |
615 int pos = 0; | 616 int pos = 0; |
616 CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap); | 617 CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap); |
617 { | 618 { |
618 for (std::vector<std::wstring>::iterator it = filters.begin(); it < filters.
end(); ++it) | 619 for (auto it = filters.begin(); it < filters.end(); ++it) |
619 { | 620 { |
620 CString filter((*it).c_str()); | 621 CString filter((*it).c_str()); |
621 // If the line is not commented out | 622 // If the line is not commented out |
622 if (!filter.Trim().IsEmpty() && filter.GetAt(0) != '!' && filter.GetAt(0)
!= '[') | 623 if (!filter.Trim().IsEmpty() && filter.GetAt(0) != '!' && filter.GetAt(0)
!= '[') |
623 { | 624 { |
624 int filterType = 0; | 625 int filterType = 0; |
625 | 626 |
626 // See http://adblockplus.org/en/filters for further documentation | 627 // See http://adblockplus.org/en/filters for further documentation |
627 | 628 |
628 try | 629 try |
(...skipping 13 matching lines...) Expand all Loading... |
642 return isRead; | 643 return isRead; |
643 } | 644 } |
644 | 645 |
645 void CPluginFilter::ClearFilters() | 646 void CPluginFilter::ClearFilters() |
646 { | 647 { |
647 // Clear filter maps | 648 // Clear filter maps |
648 CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap); | 649 CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap); |
649 m_elementHideTags.clear(); | 650 m_elementHideTags.clear(); |
650 m_elementHideTagsId.clear(); | 651 m_elementHideTagsId.clear(); |
651 m_elementHideTagsClass.clear(); | 652 m_elementHideTagsClass.clear(); |
| 653 m_hideFilters.clear(); |
652 } | 654 } |
653 | 655 |
| 656 const std::vector<std::wstring>& CPluginFilter::GetHideFilters() const |
| 657 { |
| 658 DWORD res = WaitForSingleObject(hideFiltersLoadedEvent, ENGINE_STARTUP_TIMEOUT
); |
| 659 return m_hideFilters; |
| 660 } |
OLD | NEW |