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

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

Issue 10800092: Use libadblockplus update checker (Closed)
Patch Set: Addressed review comments Created June 7, 2013, 5:27 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 "PluginConfiguration.h" 3 #include "PluginConfiguration.h"
4 #include "PluginClient.h" 4 #include "PluginClient.h"
5 #include "PluginIniFile.h" 5 #include "PluginIniFile.h"
6 #include "PluginSettings.h" 6 #include "PluginSettings.h"
7 #include "PluginSystem.h" 7 #include "PluginSystem.h"
8 #include "PluginHttpRequest.h" 8 #include "PluginHttpRequest.h"
9 9
10 10
11 CPluginConfiguration::CPluginConfiguration() : m_pluginInfoPanel(0) 11 CPluginConfiguration::CPluginConfiguration() : m_pluginInfoPanel(0)
12 { 12 {
13 Invalidate(); 13 Invalidate();
14 } 14 }
15 15
16 16
17 void CPluginConfiguration::Invalidate() 17 void CPluginConfiguration::Invalidate()
18 { 18 {
19 m_isValid = false; 19 m_isValid = false;
20 m_isValidUserId = false; 20 m_isValidUserId = false;
21 m_isValidPluginActivated = false; 21 m_isValidPluginActivated = false;
22 m_isValidPluginActivateEnabled = false; 22 m_isValidPluginActivateEnabled = false;
23 m_isValidPluginExpired = false; 23 m_isValidPluginExpired = false;
24 m_isValidPluginUpdate = false;
25 m_isValidPluginInfoPanel = false; 24 m_isValidPluginInfoPanel = false;
26 m_isValidDictionary = false; 25 m_isValidDictionary = false;
27 #ifdef SUPPORT_FILTER 26 #ifdef SUPPORT_FILTER
28 m_isValidFilter = false; 27 m_isValidFilter = false;
29 #endif 28 #endif
30 #ifdef SUPPORT_WHITELIST 29 #ifdef SUPPORT_WHITELIST
31 m_isValidWhiteList = false; 30 m_isValidWhiteList = false;
32 #endif 31 #endif
33 #ifdef SUPPORT_CONFIG 32 #ifdef SUPPORT_CONFIG
34 m_isValidConfig = false; 33 m_isValidConfig = false;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DEBUG_ERROR("Configuration::Download\n\n" + httpRequest.GetResponseText() + "\n"); 90 DEBUG_ERROR("Configuration::Download\n\n" + httpRequest.GetResponseText() + "\n");
92 return false; 91 return false;
93 } 92 }
94 93
95 const std::auto_ptr<CPluginIniFile>& iniFile = httpRequest.GetResponseFile(); 94 const std::auto_ptr<CPluginIniFile>& iniFile = httpRequest.GetResponseFile();
96 95
97 // Unpack settings 96 // Unpack settings
98 CPluginIniFile::TSectionData settingsData = iniFile->GetSectionData("Settings" ); 97 CPluginIniFile::TSectionData settingsData = iniFile->GetSectionData("Settings" );
99 CPluginIniFile::TSectionData::iterator it; 98 CPluginIniFile::TSectionData::iterator it;
100 99
101 it = settingsData.find("pluginupdate");
102 if (it != settingsData.end())
103 {
104 m_pluginUpdateUrl = it->second;
105 DEBUG_SETTINGS("Settings::Configuration plugin update url:" + it->second);
106 }
107
108 it = settingsData.find("pluginupdatev");
109 if (it != settingsData.end())
110 {
111 m_pluginUpdateVersion = it->second;
112 DEBUG_SETTINGS("Settings::Configuration plugin update version:" + it->second );
113 }
114 it = settingsData.find("userid"); 100 it = settingsData.find("userid");
115 if (it != settingsData.end()) 101 if (it != settingsData.end())
116 { 102 {
117 m_userId = it->second; 103 m_userId = it->second;
118 DEBUG_SETTINGS("Settings::Configuration user id:" + it->second); 104 DEBUG_SETTINGS("Settings::Configuration user id:" + it->second);
119 } 105 }
120 106
121 it = settingsData.find("dictionary"); 107 it = settingsData.find("dictionary");
122 if (it != settingsData.end()) 108 if (it != settingsData.end())
123 { 109 {
124 m_dictionaryUrl = it->second; 110 m_dictionaryUrl = it->second;
125 DEBUG_SETTINGS("Settings::Configuration dictionary url:" + it->second); 111 DEBUG_SETTINGS("Settings::Configuration dictionary url:" + it->second);
126 } 112 }
127 113
128 it = settingsData.find("dictionaryv"); 114 it = settingsData.find("dictionaryv");
129 if (it != settingsData.end()) 115 if (it != settingsData.end())
130 { 116 {
131 m_dictionaryVersion = atoi(it->second); 117 m_dictionaryVersion = atoi(it->second);
132 DEBUG_SETTINGS("Settings::Configuration dictionary version:" + it->second); 118 DEBUG_SETTINGS("Settings::Configuration dictionary version:" + it->second);
133 } 119 }
134 120
135 m_isValidPluginUpdate =
136 settingsData.find("pluginupdate") != settingsData.end() &&
137 settingsData.find("pluginupdatev") != settingsData.end();
138
139 m_isValidUserId = 121 m_isValidUserId =
140 settingsData.find("userid") != settingsData.end(); 122 settingsData.find("userid") != settingsData.end();
141 123
142 m_isValidDictionary = 124 m_isValidDictionary =
143 settingsData.find("dictionary") != settingsData.end() && 125 settingsData.find("dictionary") != settingsData.end() &&
144 settingsData.find("dictionaryv") != settingsData.end(); 126 settingsData.find("dictionaryv") != settingsData.end();
145 127
146 it = settingsData.find("plugininfopanel"); 128 it = settingsData.find("plugininfopanel");
147 if (it != settingsData.end()) 129 if (it != settingsData.end())
148 { 130 {
149 m_isValidPluginInfoPanel = true; 131 m_isValidPluginInfoPanel = true;
150 m_pluginInfoPanel = atoi(it->second); 132 m_pluginInfoPanel = atoi(it->second);
151 DEBUG_SETTINGS("Settings::Configuration plugin info panel:" + it->second); 133 DEBUG_SETTINGS("Settings::Configuration plugin info panel:" + it->second);
152 } 134 }
153 135
154 #ifdef SUPPORT_CONFIG 136 #ifdef SUPPORT_CONFIG
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 193 }
212 194
213 195
214 196
215 bool CPluginConfiguration::IsValidPluginExpired() const 197 bool CPluginConfiguration::IsValidPluginExpired() const
216 { 198 {
217 return m_isValidPluginExpired; 199 return m_isValidPluginExpired;
218 } 200 }
219 201
220 202
221 bool CPluginConfiguration::IsValidPluginUpdate() const
222 {
223 return m_isValidPluginUpdate;
224 }
225
226
227 bool CPluginConfiguration::IsValidDictionary() const
228 {
229 return m_isValidDictionary;
230 }
231
232
233 bool CPluginConfiguration::IsPluginActivated() const 203 bool CPluginConfiguration::IsPluginActivated() const
234 { 204 {
235 return m_isPluginActivated; 205 return m_isPluginActivated;
236 } 206 }
237 207
238 bool CPluginConfiguration::IsPluginRegistered() const 208 bool CPluginConfiguration::IsPluginRegistered() const
239 { 209 {
240 return m_isPluginRegistered; 210 return m_isPluginRegistered;
241 } 211 }
242 212
243 int CPluginConfiguration::GetAdBlockLimit() const 213 int CPluginConfiguration::GetAdBlockLimit() const
244 { 214 {
245 return m_adBlockLimit; 215 return m_adBlockLimit;
246 } 216 }
247 217
248 218
249 bool CPluginConfiguration::IsPluginActivateEnabled() const 219 bool CPluginConfiguration::IsPluginActivateEnabled() const
250 { 220 {
251 return m_isPluginActivateEnabled; 221 return m_isPluginActivateEnabled;
252 } 222 }
253 223
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 return m_userId; 267 return m_userId;
298 } 268 }
299 269
300 270
301 int CPluginConfiguration::GetPluginInfoPanel() const 271 int CPluginConfiguration::GetPluginInfoPanel() const
302 { 272 {
303 return m_pluginInfoPanel; 273 return m_pluginInfoPanel;
304 } 274 }
305 275
306 276
307 CString CPluginConfiguration::GetPluginUpdateUrl() const
308 {
309 return PLUGIN_UPDATE_URL;
310 }
311
312
313 CString CPluginConfiguration::GetPluginUpdateVersion() const
314 {
315 return m_pluginUpdateVersion;
316 }
317
318
319 int CPluginConfiguration::GetDictionaryVersion() const 277 int CPluginConfiguration::GetDictionaryVersion() const
320 { 278 {
321 return m_dictionaryVersion; 279 return m_dictionaryVersion;
322 } 280 }
323 281
324 282
325 CString CPluginConfiguration::GetDictionaryUrl() const 283 CString CPluginConfiguration::GetDictionaryUrl() const
326 { 284 {
327 return m_dictionaryUrl; 285 return m_dictionaryUrl;
328 } 286 }
(...skipping 18 matching lines...) Expand all
347 305
348 #endif // SUPPORT_CONFIG 306 #endif // SUPPORT_CONFIG
349 307
350 308
351 #ifdef PRODUCT_AIDOINLINE 309 #ifdef PRODUCT_AIDOINLINE
352 CString CPluginConfiguration::GetCollectedStatus() const 310 CString CPluginConfiguration::GetCollectedStatus() const
353 { 311 {
354 return m_collectedStatus; 312 return m_collectedStatus;
355 } 313 }
356 #endif 314 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld