Index: src/plugin/PluginFilter.h |
=================================================================== |
--- a/src/plugin/PluginFilter.h |
+++ b/src/plugin/PluginFilter.h |
@@ -20,6 +20,7 @@ |
#include <memory> |
#include <AdblockPlus/FilterEngine.h> |
+#include "DetachedInitialization.h" |
enum CFilterElementHideAttrPos |
{ |
@@ -118,6 +119,7 @@ |
// ============================================================================ |
class CPluginFilter |
+ : private DetachedInitializer |
{ |
// (Tag,Name) -> Filter |
typedef std::multimap<std::pair<std::wstring, std::wstring>, CFilterElementHide> TFilterElementHideTagsNamed; |
@@ -126,14 +128,22 @@ |
TFilterElementHideTagsNamed m_elementHideTagsId; |
TFilterElementHideTagsNamed m_elementHideTagsClass; |
TFilterElementHideTags m_elementHideTags; |
- void ClearFilters(); |
+ bool AddFilterElementHide(std::wstring filter); |
+ bool LoadHideFilters(); |
+ const std::wstring& domain; |
sergei
2016/01/29 10:03:20
That's very dangerous, make it non-reference.
Eric
2016/02/03 18:03:20
Done.
|
+ InitializerType Initializer() override |
+ { |
+ return [this] { LoadHideFilters(); }; |
+ } |
public: |
- CPluginFilter(); |
- bool LoadHideFilters(std::vector<std::wstring> filters); |
- bool AddFilterElementHide(std::wstring filter); |
+ CPluginFilter(const std::wstring& domain) |
+ : domain(domain) |
+ { |
+ SpawnInitializer(); |
+ } |
bool IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::wstring& domain, const std::wstring& indent) const; |
- HANDLE hideFiltersLoadedEvent; |
+ void EnsureInitialized() { DetachedInitializer::EnsureInitialized(); } |
}; |