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

Side by Side Diff: Shared/PluginFilter.cpp

Issue 8949229: Removal of all user tracking and shareware parts (Closed)
Patch Set: Created Dec. 6, 2012, 4:38 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 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginFilter.h" 3 #include "PluginFilter.h"
4 4
5 #if (defined PRODUCT_SIMPLEADBLOCK) 5 #if (defined PRODUCT_SIMPLEADBLOCK)
6 #include "PluginSettings.h" 6 #include "PluginSettings.h"
7 #include "PluginClient.h" 7 #include "PluginClient.h"
8 #include "PluginClientFactory.h" 8 #include "PluginClientFactory.h"
9 #endif 9 #endif
10 10
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 { 1781 {
1782 // We should not block the empty string, so all filtering does not make sens e 1782 // We should not block the empty string, so all filtering does not make sens e
1783 // Therefore we just return 1783 // Therefore we just return
1784 if (src.Trim().IsEmpty()) 1784 if (src.Trim().IsEmpty())
1785 { 1785 {
1786 return false; 1786 return false;
1787 } 1787 }
1788 1788
1789 CPluginSettings* settings = CPluginSettings::GetInstance(); 1789 CPluginSettings* settings = CPluginSettings::GetInstance();
1790 1790
1791
1792 if (!settings->GetBool(SETTING_PLUGIN_REGISTRATION, false))
1793 {
1794 //is the limit exceeded?
1795 if ((settings->GetValue(SETTING_PLUGIN_ADBLOCKCOUNT, 0) >= setti ngs->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0))
1796 && (settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0) > 0))
1797 {
1798 return false;
1799 }
1800 }
1801
1802
1803
1804 CString type; 1791 CString type;
1805 if (addDebug) 1792 if (addDebug)
1806 { 1793 {
1807 type = "???"; 1794 type = "???";
1808 1795
1809 std::map<int,CString>::const_iterator it = m_contentMapText.find(con tentType); 1796 std::map<int,CString>::const_iterator it = m_contentMapText.find(con tentType);
1810 if (it != m_contentMapText.end()) 1797 if (it != m_contentMapText.end())
1811 { 1798 {
1812 type = it->second; 1799 type = it->second;
1813 } 1800 }
(...skipping 18 matching lines...) Expand all
1832 #ifdef ENABLE_DEBUG_RESULT 1819 #ifdef ENABLE_DEBUG_RESULT
1833 CPluginDebug::DebugResultBlocking(type, src, blockFilter->m_filterTe xt, blockFilter->m_filterFile); 1820 CPluginDebug::DebugResultBlocking(type, src, blockFilter->m_filterTe xt, blockFilter->m_filterFile);
1834 #endif 1821 #endif
1835 } 1822 }
1836 } 1823 }
1837 else if (addDebug) 1824 else if (addDebug)
1838 { 1825 {
1839 DEBUG_FILTER("Filter::ShouldBlock " + type + " NO src:" + src) 1826 DEBUG_FILTER("Filter::ShouldBlock " + type + " NO src:" + src)
1840 } 1827 }
1841 1828
1842
1843 if (blockFilter)
1844 {
1845 //is plugin registered
1846 if (!settings->GetBool(SETTING_PLUGIN_REGISTRATION, false))
1847 {
1848 //is the limit exceeded? When the upgrade dialog is disp layed adblockcount is set to 1000000
1849 if ((settings->GetValue(SETTING_PLUGIN_ADBLOCKCOUNT, 0) >= settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0))
1850 && (settings->GetValue(SETTING_PLUGIN_ADBLOCKLIM IT, 0) > 0))
1851 {
1852 return false;
1853 }
1854 }
1855 }
1856 return blockFilter ? true : false; 1829 return blockFilter ? true : false;
1857 } 1830 }
1858 1831
1859 int CPluginFilter::FindMatch(const CString& src, CString filterPart, int srcStar tPos) const 1832 int CPluginFilter::FindMatch(const CString& src, CString filterPart, int srcStar tPos) const
1860 { 1833 {
1861 int filterCurrentPos = filterPart.Find('^'); 1834 int filterCurrentPos = filterPart.Find('^');
1862 if (filterCurrentPos >= 0) 1835 if (filterCurrentPos >= 0)
1863 { 1836 {
1864 int srcLength = src.GetLength(); 1837 int srcLength = src.GetLength();
1865 int srcFilterPos = -1; 1838 int srcFilterPos = -1;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 s_criticalSectionFilterMap.Lock(); 2058 s_criticalSectionFilterMap.Lock();
2086 { 2059 {
2087 isAlive = !m_filterMap[0][0].empty(); 2060 isAlive = !m_filterMap[0][0].empty();
2088 } 2061 }
2089 s_criticalSectionFilterMap.Unlock(); 2062 s_criticalSectionFilterMap.Unlock();
2090 2063
2091 return isAlive; 2064 return isAlive;
2092 } 2065 }
2093 2066
2094 #endif 2067 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld