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

Side by Side Diff: Shared/PluginSettings.cpp

Issue 8978054: Removal of shareware parts (Closed)
Patch Set: Created Dec. 5, 2012, 7:59 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Shared/PluginSettings.h ('k') | Shared/PluginWbPassThrough.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include <Wbemidl.h> 3 #include <Wbemidl.h>
4 4
5 #include "PluginIniFileW.h" 5 #include "PluginIniFileW.h"
6 #include "PluginSettings.h" 6 #include "PluginSettings.h"
7 #include "PluginDictionary.h" 7 #include "PluginDictionary.h"
8 #include "PluginClient.h" 8 #include "PluginClient.h"
9 #include "PluginChecksum.h" 9 #include "PluginChecksum.h"
10 #ifdef SUPPORT_FILTER 10 #ifdef SUPPORT_FILTER
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 353 }
354 354
355 355
356 void CPluginSettings::Clear() 356 void CPluginSettings::Clear()
357 { 357 {
358 // Default settings 358 // Default settings
359 s_criticalSectionLocal.Lock(); 359 s_criticalSectionLocal.Lock();
360 { 360 {
361 m_properties.clear(); 361 m_properties.clear();
362 362
363 m_properties[SETTING_PLUGIN_EXPIRED] = "false";
364 m_properties[SETTING_PLUGIN_VERSION] = IEPLUGIN_VERSION; 363 m_properties[SETTING_PLUGIN_VERSION] = IEPLUGIN_VERSION;
365 m_properties[SETTING_LANGUAGE] = "en"; 364 m_properties[SETTING_LANGUAGE] = "en";
366 m_properties[SETTING_DICTIONARY_VERSION] = "1"; 365 m_properties[SETTING_DICTIONARY_VERSION] = "1";
367 m_properties[SETTING_PLUGIN_REGISTRATION] = "false";
368 } 366 }
369 s_criticalSectionLocal.Unlock(); 367 s_criticalSectionLocal.Unlock();
370 368
371 // Default filters 369 // Default filters
372 #ifdef SUPPORT_FILTER 370 #ifdef SUPPORT_FILTER
373 371
374 s_criticalSectionFilters.Lock(); 372 s_criticalSectionFilters.Lock();
375 { 373 {
376 m_filterUrlList.clear(); 374 m_filterUrlList.clear();
377 m_filterUrlList[CString(FILTERS_PROTOCOL) + CString(FILTERS_HOST ) + "/easylist.txt"] = 1; 375 m_filterUrlList[CString(FILTERS_PROTOCOL) + CString(FILTERS_HOST ) + "/easylist.txt"] = 1;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 741
744 742
745 void CPluginSettings::SetBool(const CString& key, bool value) 743 void CPluginSettings::SetBool(const CString& key, bool value)
746 { 744 {
747 SetString(key, value ? "true":"false"); 745 SetString(key, value ? "true":"false");
748 } 746 }
749 747
750 748
751 bool CPluginSettings::IsPluginEnabled() const 749 bool CPluginSettings::IsPluginEnabled() const
752 { 750 {
753 » return m_isPluginEnabledTab && !GetBool(SETTING_PLUGIN_EXPIRED, false); 751 » return m_isPluginEnabledTab;
754 } 752 }
755 753
756 754
757 #ifdef SUPPORT_FILTER 755 #ifdef SUPPORT_FILTER
758 756
759 void CPluginSettings::SetFilterUrlList(const TFilterUrlList& filters) 757 void CPluginSettings::SetFilterUrlList(const TFilterUrlList& filters)
760 { 758 {
761 DEBUG_SETTINGS(L"Settings::SetFilterUrlList") 759 DEBUG_SETTINGS(L"Settings::SetFilterUrlList")
762 760
763 s_criticalSectionFilters.Lock(); 761 s_criticalSectionFilters.Lock();
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 m_propertiesTab[SETTING_TAB_PLUGIN_ENABLED] = "true"; 1443 m_propertiesTab[SETTING_TAB_PLUGIN_ENABLED] = "true";
1446 m_isDirtyTab = true; 1444 m_isDirtyTab = true;
1447 } 1445 }
1448 s_criticalSectionLocal.Unlock(); 1446 s_criticalSectionLocal.Unlock();
1449 1447
1450 WriteTab(false); 1448 WriteTab(false);
1451 } 1449 }
1452 } 1450 }
1453 bool CPluginSettings::GetPluginEnabled() const 1451 bool CPluginSettings::GetPluginEnabled() const
1454 { 1452 {
1455 //Display plugin as disabled if limit is passed
1456 CPluginSettings* settings = CPluginSettings::GetInstance();
1457 if (!settings->GetBool(SETTING_PLUGIN_REGISTRATION, false) &&
1458 (settings->GetValue(SETTING_PLUGIN_ADBLOCKCOUNT, 0) >= settings- >GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0)) &&
1459 (settings->GetValue(SETTING_PLUGIN_ADBLOCKLIMIT, 0) > 0))
1460 {
1461 return false;
1462 }
1463 return m_isPluginEnabledTab; 1453 return m_isPluginEnabledTab;
1464 } 1454 }
1465 1455
1466 1456
1467 void CPluginSettings::AddError(const CString& error, const CString& errorCode) 1457 void CPluginSettings::AddError(const CString& error, const CString& errorCode)
1468 { 1458 {
1469 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCod e) 1459 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCod e)
1470 1460
1471 CPluginSettingsTabLock lock; 1461 CPluginSettingsTabLock lock;
1472 if (lock.IsLocked()) 1462 if (lock.IsLocked())
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); 2099 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
2110 bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi); 2100 bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
2111 2101
2112 m_WindowsBuildNumber = osvi.dwBuildNumber; 2102 m_WindowsBuildNumber = osvi.dwBuildNumber;
2113 } 2103 }
2114 2104
2115 return m_WindowsBuildNumber; 2105 return m_WindowsBuildNumber;
2116 } 2106 }
2117 2107
2118 #endif // SUPPORT_WHITELIST 2108 #endif // SUPPORT_WHITELIST
OLDNEW
« no previous file with comments | « Shared/PluginSettings.h ('k') | Shared/PluginWbPassThrough.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld