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

Side by Side Diff: src/plugin/PluginSettings.cpp

Issue 11013110: Cleanup (Closed)
Patch Set: SetPref/GetPref type safety. Comments addressed. Created July 22, 2013, 12:42 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
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include <Wbemidl.h> 3 #include <Wbemidl.h>
4 #include <time.h> 4 #include <time.h>
5 #include "PluginSettings.h" 5 #include "PluginSettings.h"
6 #include "PluginClient.h" 6 #include "PluginClient.h"
7 #include "PluginSystem.h" 7 #include "PluginSystem.h"
8 #ifdef SUPPORT_FILTER 8 #ifdef SUPPORT_FILTER
9 #include "PluginFilter.h" 9 #include "PluginFilter.h"
10 #endif 10 #endif
11 #include "PluginMutex.h" 11 #include "PluginMutex.h"
12 #include "../shared/Utils.h" 12 #include "../shared/Utils.h"
13 #include <memory> 13 #include <memory>
14 14
15 15
16 // IE functions 16 // IE functions
17 #pragma comment(lib, "iepmapi.lib") 17 #pragma comment(lib, "iepmapi.lib")
18 18
19 #include <knownfolders.h> 19 #include <knownfolders.h>
20 20
21 namespace 21 namespace
22 { 22 {
23 std::wstring CreateDomainWhitelistingFilter(CString domain) 23 std::wstring CreateDomainWhitelistingFilter(const CString domain)
24 { 24 {
25 return std::wstring(L"@@||" + domain + L"^$document"); 25 return L"@@||" + domain + L"^$document";
26 } 26 }
27 } 27 }
28 28
29 class TSettings 29 class TSettings
30 { 30 {
31 DWORD processorId; 31 DWORD processorId;
32 32
33 char sPluginId[44]; 33 char sPluginId[44];
34 }; 34 };
35 35
(...skipping 23 matching lines...) Expand all
59 ~CPluginSettingsWhitelistLock() {} 59 ~CPluginSettingsWhitelistLock() {}
60 }; 60 };
61 61
62 #endif 62 #endif
63 63
64 CPluginSettings* CPluginSettings::s_instance = NULL; 64 CPluginSettings* CPluginSettings::s_instance = NULL;
65 65
66 CComAutoCriticalSection CPluginSettings::s_criticalSectionLocal; 66 CComAutoCriticalSection CPluginSettings::s_criticalSectionLocal;
67 67
68 68
69 CPluginSettings::CPluginSettings() : 69 CPluginSettings::CPluginSettings() : m_dwWorkingThreadId(0), m_isPluginEnabledTa b(true)
70 m_settingsVersion("1"), m_dwWorkingThreadId(0), m_isPluginEnabledTab(true)
71 { 70 {
72 s_instance = NULL; 71 s_instance = NULL;
73 72
74 m_WindowsBuildNumber = 0; 73 m_WindowsBuildNumber = 0;
75 74
76 #ifdef SUPPORT_WHITELIST 75 #ifdef SUPPORT_WHITELIST
77 ClearWhitelist(); 76 ClearWhitelist();
78 #endif 77 #endif
79 } 78 }
80 79
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 238 }
240 } 239 }
241 bool CPluginSettings::GetPluginEnabled() const 240 bool CPluginSettings::GetPluginEnabled() const
242 { 241 {
243 //TODO: Query AdblockPlusEngine 242 //TODO: Query AdblockPlusEngine
244 return m_isPluginEnabledTab; 243 return m_isPluginEnabledTab;
245 } 244 }
246 245
247 bool CPluginSettings::GetStatusBarAsked() 246 bool CPluginSettings::GetStatusBarAsked()
248 { 247 {
249 std::wstring res = CPluginClient::GetInstance()->GetPref(L"statusbarasked"); 248 return CPluginClient::GetInstance()->GetPref(L"statusbarasked", false);
250 return res == L"true";
251 } 249 }
252 250
253 void CPluginSettings::SetStatusBarAsked() 251 void CPluginSettings::SetStatusBarAsked()
254 { 252 {
255 CPluginClient::GetInstance()->SetPref(L"statusbarasked", L"true"); 253 CPluginClient::GetInstance()->SetPref(L"statusbarasked", true);
256 } 254 }
257 255
258 256
259 void CPluginSettings::AddError(const CString& error, const CString& errorCode) 257 void CPluginSettings::AddError(const CString& error, const CString& errorCode)
260 { 258 {
261 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode) 259 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode)
262 } 260 }
263 261
264 262
265 // ============================================================================ 263 // ============================================================================
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstanc e()->GetListedSubscriptions(); 380 std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstanc e()->GetListedSubscriptions();
383 if (subscriptions.size() > 0) 381 if (subscriptions.size() > 0)
384 return CString(subscriptions.front().url.c_str()); 382 return CString(subscriptions.front().url.c_str());
385 else 383 else
386 return CString(L""); 384 return CString(L"");
387 } 385 }
388 386
389 387
390 388
391 #endif // SUPPORT_WHITELIST 389 #endif // SUPPORT_WHITELIST
OLDNEW

Powered by Google App Engine
This is Rietveld