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

Unified Diff: src/plugin/PluginFilter.h

Issue 29334397: Issue #2230, #3391 - Load filters on "download begin" event
Patch Set: address comments Created Feb. 3, 2016, 6:04 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/plugin/PluginDomTraverserBase.h ('k') | src/plugin/PluginFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ 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(); }
};
« no previous file with comments | « src/plugin/PluginDomTraverserBase.h ('k') | src/plugin/PluginFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld