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

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

Issue 29323611: Issue #1234, #2058 - Rewrite log facility, improving thread implementation
Patch Set: rebase only Created July 27, 2016, 9:11 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/PluginSystem.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 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 instance = s_instance; 66 instance = s_instance;
67 } 67 }
68 s_criticalSectionLocal.Unlock(); 68 s_criticalSectionLocal.Unlock();
69 69
70 return instance; 70 return instance;
71 } 71 }
72 72
73 73
74 bool CPluginSettings::HasInstance()
75 {
76 bool hasInstance = true;
77
78 s_criticalSectionLocal.Lock();
79 {
80 hasInstance = s_instance != NULL;
81 }
82 s_criticalSectionLocal.Unlock();
83
84 return hasInstance;
85 }
86
87 bool CPluginSettings::IsPluginEnabled() const 74 bool CPluginSettings::IsPluginEnabled() const
88 { 75 {
89 return GetPluginEnabled(); 76 return GetPluginEnabled();
90 } 77 }
91 78
92 std::map<std::wstring, std::wstring> CPluginSettings::GetFilterLanguageTitleList () const 79 std::map<std::wstring, std::wstring> CPluginSettings::GetFilterLanguageTitleList () const
93 { 80 {
94 auto subscriptions = CPluginClient::GetInstance()->FetchAvailableSubscriptions (); 81 auto subscriptions = CPluginClient::GetInstance()->FetchAvailableSubscriptions ();
95 82
96 std::map<std::wstring, std::wstring> filterList; 83 std::map<std::wstring, std::wstring> filterList;
97 for (size_t i = 0; i < subscriptions.size(); i ++) 84 for (size_t i = 0; i < subscriptions.size(); i ++)
98 { 85 {
99 auto it = subscriptions[i]; 86 auto it = subscriptions[i];
100 filterList.insert(std::make_pair(it.url, it.title)); 87 filterList.insert(std::make_pair(it.url, it.title));
101 } 88 }
102 return filterList; 89 return filterList;
103 } 90 }
104 91
105 void CPluginSettings::TogglePluginEnabled() 92 void CPluginSettings::TogglePluginEnabled()
106 { 93 {
107 CPluginClient::GetInstance()->TogglePluginEnabled(); 94 CPluginClient::GetInstance()->TogglePluginEnabled();
108 } 95 }
109 bool CPluginSettings::GetPluginEnabled() const 96 bool CPluginSettings::GetPluginEnabled() const
110 { 97 {
111 return CPluginClient::GetInstance()->GetPref(L"enabled", true); 98 return CPluginClient::GetInstance()->GetPref(L"enabled", true);
112 } 99 }
113 100
114 void CPluginSettings::AddError(const CString& error, const CString& errorCode)
115 {
116 DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode)
117 }
118
119 // ============================================================================ 101 // ============================================================================
120 // Whitelist settings 102 // Whitelist settings
121 // ============================================================================ 103 // ============================================================================
122 104
123 void CPluginSettings::ClearWhitelist() 105 void CPluginSettings::ClearWhitelist()
124 { 106 {
125 s_criticalSectionLocal.Lock(); 107 s_criticalSectionLocal.Lock();
126 { 108 {
127 m_whitelistedDomains.clear(); 109 m_whitelistedDomains.clear();
128 } 110 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 195
214 for (auto subscription = subscriptions.begin(); subscription != subscriptions. end(); subscription++) 196 for (auto subscription = subscriptions.begin(); subscription != subscriptions. end(); subscription++)
215 { 197 {
216 if (subscription->url != aaUrl) 198 if (subscription->url != aaUrl)
217 { 199 {
218 return subscription->url; 200 return subscription->url;
219 } 201 }
220 } 202 }
221 return std::wstring(); 203 return std::wstring();
222 } 204 }
OLDNEW
« no previous file with comments | « src/plugin/PluginSettings.h ('k') | src/plugin/PluginSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld