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

Unified Diff: src/plugin/PluginSettings.cpp

Issue 10800092: Use libadblockplus update checker (Closed)
Patch Set: Addressed review comments Created June 7, 2013, 5:27 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/plugin/PluginSettings.cpp
===================================================================
--- a/src/plugin/PluginSettings.cpp
+++ b/src/plugin/PluginSettings.cpp
@@ -255,65 +255,16 @@ void CPluginSettings::Clear()
m_properties.clear();
m_properties[SETTING_PLUGIN_VERSION] = IEPLUGIN_VERSION;
m_properties[SETTING_LANGUAGE] = "en";
}
s_criticalSectionLocal.Unlock();
}
-bool CPluginSettings::MakeRequestForUpdate()
-{
- time_t updateTime = this->GetValue(SETTING_LAST_UPDATE_TIME);
-
- if (time(NULL) <= updateTime)
- return false;
-
- CPluginHttpRequest httpRequest(PLUGIN_UPDATE_URL);
-
- CPluginSystem* system = CPluginSystem::GetInstance();
-
- httpRequest.Add("lang", this->GetString(SETTING_LANGUAGE, "err"));
- httpRequest.Add("ie", system->GetBrowserVersion());
- httpRequest.Add("ielang", system->GetBrowserLanguage());
-
- httpRequest.AddOsInfo();
-
- httpRequest.Send();
-
- this->SetValue(SETTING_LAST_UPDATE_TIME, time(NULL) + (5 * 24 * 60 * 60) * ((rand() % 100) / 100 * 0.4 + 0.8));
- if (httpRequest.IsValidResponse())
- {
- const std::auto_ptr<CPluginIniFile>& iniFile = httpRequest.GetResponseFile();
-
- CPluginIniFile::TSectionData settingsData = iniFile->GetSectionData("Settings");
- CPluginIniFile::TSectionData::iterator it;
-
- it = settingsData.find("pluginupdate");
- if (it != settingsData.end())
- {
- CString url(it->second);
- SetString(SETTING_PLUGIN_UPDATE_URL, url);
- m_isDirty = true;
- DEBUG_SETTINGS("Settings::Configuration plugin update url:" + it->second);
- }
-
- it = settingsData.find("pluginupdatev");
- if (it != settingsData.end())
- {
- CString ver(it->second);
- SetString(SETTING_PLUGIN_UPDATE_VERSION, ver);
- m_isDirty = true;
- DEBUG_SETTINGS("Settings::Configuration plugin update version:" + it->second);
- }
- }
-
- return true;
-}
-
CString CPluginSettings::GetDataPath(const CString& filename)
{
std::wstring path = ::GetAppDataPath() + L"\\" + static_cast<LPCWSTR>(filename);
return CString(path.c_str());
}
CString CPluginSettings::GetSystemLanguage()
{
@@ -618,44 +569,16 @@ bool CPluginSettings::Write(bool isDebug
{
isWritten = false;
}
return isWritten;
}
-bool CPluginSettings::IsPluginUpdateAvailable() const
-{
- bool isAvailable = Has(SETTING_PLUGIN_UPDATE_VERSION);
- if (isAvailable)
- {
- CString newVersion = GetString(SETTING_PLUGIN_UPDATE_VERSION);
- CString curVersion = IEPLUGIN_VERSION;
-
- isAvailable = newVersion != curVersion;
- if (isAvailable)
- {
- int curPos = 0;
- int curMajor = _wtoi(curVersion.Tokenize(L".", curPos));
- int curMinor = _wtoi(curVersion.Tokenize(L".", curPos));
- int curDev = _wtoi(curVersion.Tokenize(L".", curPos));
-
- int newPos = 0;
- int newMajor = _wtoi(newVersion.Tokenize(L".", newPos));
- int newMinor = newPos > 0 ? _wtoi(newVersion.Tokenize(L".", newPos)) : 0;
- int newDev = newPos > 0 ? _wtoi(newVersion.Tokenize(L".", newPos)) : 0;
-
- isAvailable = newMajor > curMajor || newMajor == curMajor && newMinor > curMinor || newMajor == curMajor && newMinor == curMinor && newDev > curDev;
- }
- }
-
- return isAvailable;
-}
-
bool CPluginSettings::IsMainProcess(DWORD dwProcessId) const
{
if (dwProcessId == 0)
{
dwProcessId = ::GetCurrentProcessId();
}
return m_dwMainProcessId == dwProcessId;
}

Powered by Google App Engine
This is Rietveld