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

Unified Diff: src/plugin/PluginFilter.cpp

Issue 6567422169448448: Issue 119 - Switch to injecting CSS for element hiding (Closed)
Patch Set: rebase and address comments Created April 13, 2015, 8:04 a.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/PluginFilter.h ('k') | src/plugin/PluginTabBase.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginFilter.cpp
diff --git a/src/plugin/PluginFilter.cpp b/src/plugin/PluginFilter.cpp
index 86217c9f8fd0b7ffd4e3f6757176942c9179f057..73ca318b99999e41b1299bf9f21a02b5fd5cc23e 100644
--- a/src/plugin/PluginFilter.cpp
+++ b/src/plugin/PluginFilter.cpp
@@ -651,9 +651,10 @@ bool CPluginFilter::IsElementHidden(const std::wstring& tag, IHTMLElement* pEl,
return false;
}
-bool CPluginFilter::LoadHideFilters(std::vector<std::wstring> filters)
+bool CPluginFilter::LoadHideFilters(const std::vector<std::wstring>& filters)
{
ClearFilters();
+ m_hideFilters = filters;
bool isRead = false;
CPluginClient* client = CPluginClient::GetInstance();
@@ -661,7 +662,7 @@ bool CPluginFilter::LoadHideFilters(std::vector<std::wstring> filters)
int pos = 0;
CriticalSection::Lock filterEngineLock(s_criticalSectionFilterMap);
{
- for (std::vector<std::wstring>::iterator it = filters.begin(); it < filters.end(); ++it)
+ for (auto it = filters.begin(); it < filters.end(); ++it)
{
CString filter((*it).c_str());
// If the line is not commented out
@@ -695,6 +696,7 @@ void CPluginFilter::ClearFilters()
m_elementHideTags.clear();
m_elementHideTagsId.clear();
m_elementHideTagsClass.clear();
+ m_hideFilters.clear();
}
bool CPluginFilter::ShouldBlock(const std::wstring& src, AdblockPlus::FilterEngine::ContentType contentType, const std::wstring& domain, bool addDebug) const
@@ -729,3 +731,9 @@ bool CPluginFilter::ShouldBlock(const std::wstring& src, AdblockPlus::FilterEngi
#endif
return result;
}
+
+const std::vector<std::wstring>& CPluginFilter::GetHideFilters() const
+{
+ DWORD res = WaitForSingleObject(hideFiltersLoadedEvent, ENGINE_STARTUP_TIMEOUT);
+ return m_hideFilters;
+}
« no previous file with comments | « src/plugin/PluginFilter.h ('k') | src/plugin/PluginTabBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld