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

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

Issue 11043057: First run page triggering (Closed)
Patch Set: Minor refactoring. Renaming and a small cleanup. Created July 26, 2013, 12:05 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
« no previous file with comments | « src/plugin/PluginSettings.h ('k') | src/plugin/PluginTabBase.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 #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
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void CPluginSettings::SetWorkingThreadId() 180 void CPluginSettings::SetWorkingThreadId()
181 { 181 {
182 m_dwWorkingThreadId = ::GetCurrentThreadId(); 182 m_dwWorkingThreadId = ::GetCurrentThreadId();
183 } 183 }
184 184
185 void CPluginSettings::SetWorkingThreadId(DWORD id) 185 void CPluginSettings::SetWorkingThreadId(DWORD id)
186 { 186 {
187 m_dwWorkingThreadId = id; 187 m_dwWorkingThreadId = id;
188 } 188 }
189 189
190 void CPluginSettings::SetFirstRun()
191 {
192 m_isFirstRun = true;
193 }
194
195 bool CPluginSettings::IsFirstRun() const
196 {
197 return m_isFirstRun;
198 }
199
200 void CPluginSettings::TogglePluginEnabled() 190 void CPluginSettings::TogglePluginEnabled()
201 { 191 {
202 CPluginSettingsTabLock lock; 192 CPluginSettingsTabLock lock;
203 if (lock.IsLocked()) 193 if (lock.IsLocked())
204 { 194 {
205 s_criticalSectionLocal.Lock(); 195 s_criticalSectionLocal.Lock();
206 { 196 {
207 //TODO: Query if plugin is enabled from the AdblockPlusEngine 197 //TODO: Query if plugin is enabled from the AdblockPlusEngine
208 m_isPluginEnabledTab = m_isPluginEnabledTab ? false : true; 198 m_isPluginEnabledTab = m_isPluginEnabledTab ? false : true;
209 //TODO: Set plugin enabled/disabled in AdblockPlusEngine 199 //TODO: Set plugin enabled/disabled in AdblockPlusEngine
(...skipping 26 matching lines...) Expand all
236 } 226 }
237 s_criticalSectionLocal.Unlock(); 227 s_criticalSectionLocal.Unlock();
238 } 228 }
239 } 229 }
240 bool CPluginSettings::GetPluginEnabled() const 230 bool CPluginSettings::GetPluginEnabled() const
241 { 231 {
242 //TODO: Query AdblockPlusEngine 232 //TODO: Query AdblockPlusEngine
243 return m_isPluginEnabledTab; 233 return m_isPluginEnabledTab;
244 } 234 }
245 235
246 bool CPluginSettings::GetStatusBarAsked()
247 {
248 return CPluginClient::GetInstance()->GetPref(L"statusbarasked", false);
249 }
250
251 void CPluginSettings::SetStatusBarAsked()
252 {
253 CPluginClient::GetInstance()->SetPref(L"statusbarasked", true);
254 }
255
256 236
257 void CPluginSettings::AddError(const CString& error, const CString& errorCode) 237 void CPluginSettings::AddError(const CString& error, const CString& errorCode)
258 { 238 {
259 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode) 239 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode)
260 } 240 }
261 241
262 242
263 // ============================================================================ 243 // ============================================================================
264 // Whitelist settings 244 // Whitelist settings
265 // ============================================================================ 245 // ============================================================================
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstanc e()->GetListedSubscriptions(); 360 std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstanc e()->GetListedSubscriptions();
381 if (subscriptions.size() > 0) 361 if (subscriptions.size() > 0)
382 return CString(subscriptions.front().url.c_str()); 362 return CString(subscriptions.front().url.c_str());
383 else 363 else
384 return CString(L""); 364 return CString(L"");
385 } 365 }
386 366
387 367
388 368
389 #endif // SUPPORT_WHITELIST 369 #endif // SUPPORT_WHITELIST
OLDNEW
« no previous file with comments | « src/plugin/PluginSettings.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld