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

Unified Diff: src/plugin/PluginClassThread.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/PluginClassThread.cpp
===================================================================
--- a/src/plugin/PluginClassThread.cpp
+++ b/src/plugin/PluginClassThread.cpp
@@ -10,18 +10,16 @@
#ifdef SUPPORT_FILTER
#include "PluginFilter.h"
#endif
#ifdef SUPPORT_CONFIG
#include "PluginConfig.h"
#endif
#include "PluginMimeFilterClient.h"
-#include "PluginUpdateDialog.h"
-#include "PluginDownloadDialog.h"
#include "PluginClient.h"
#include "PluginClientFactory.h"
#include "PluginWbPassThrough.h"
#include "PluginHttpRequest.h"
#include "ProtocolImpl.h"
#include "ProtocolCF.h"
@@ -134,53 +132,16 @@ DWORD WINAPI CPluginClass::MainThreadPro
{
settings->Remove(SETTING_PLUGIN_INFO_PANEL);
settings->Write();
}
}
}
// --------------------------------------------------------------------
- // Should update plugin ?
- // --------------------------------------------------------------------
-
- if (!IsMainThreadDone(hMainThread) && settings->IsPluginUpdateAvailable())
- {
- DEBUG_THREAD(L"Thread::Should update plugin");
-
- CString lastUpdateStr = settings->GetString(SETTING_PLUGIN_UPDATE_TIME);
-
- std::time_t today = std::time(NULL);
- std::time_t lastUpdate = lastUpdateStr.IsEmpty() ? today : _wtoi(lastUpdateStr.GetBuffer());
-
- if (today != (std::time_t)(-1) && lastUpdate != (std::time_t)(-1))
- {
- if (today == lastUpdate || std::difftime(today, lastUpdate) / (60 * 60 * 24) >= 5.0)
- {
- CString updateVersion = settings->GetString(SETTING_PLUGIN_UPDATE_VERSION);
-
- DEBUG_GENERAL(L"*** Displaying update plugin dialog for version " + updateVersion);
-
- // Show update dialog
- CUpdateDialog uDlg;
-
- uDlg.SetVersions(updateVersion, IEPLUGIN_VERSION);
-
- if (uDlg.DoModal(::GetDesktopWindow()) == IDOK)
- {
- s_isPluginToBeUpdated = true;
- }
-
- settings->SetValue(SETTING_PLUGIN_UPDATE_TIME, (int)today);
- settings->Write();
- }
- }
- }
-
- // --------------------------------------------------------------------
// Main loop
// --------------------------------------------------------------------
DWORD mainLoopIteration = 1;
while (!IsMainThreadDone(hMainThread))
{
CString sMainLoopIteration;
@@ -238,85 +199,37 @@ DWORD WINAPI CPluginClass::MainThreadPro
// Update filters, if needed (5 days * (random() * 0.4 + 0.8))
if (isNewFilterVersion)
{
DEBUG_GENERAL("*** before CheckFilterAndDownload");
settings->RefreshFilterlist();
- settings->MakeRequestForUpdate();
-
settings->Write();
tab->OnUpdate();
}
#endif // SUPPORT_FILTER
}
}
-#ifndef ENTERPRISE
- // --------------------------------------------------------------------
- // Update plugin
- // --------------------------------------------------------------------
-
- if (!IsMainThreadDone(hMainThread) && s_isPluginToBeUpdated)
- {
- DEBUG_GENERAL(L"*** Displaying download plugin dialog");
-
- s_isPluginToBeUpdated = false;
-
- try
- {
- CString updateUrl = settings->GetString(SETTING_PLUGIN_UPDATE_URL);
- CString updatePath = L"";
- if (updateUrl.Find(L".exe") == updateUrl.GetLength() - 4)
- {
- updatePath = CPluginSettings::GetTempPath(INSTALL_EXE_FILE);
- // Delete old installer
- ::DeleteFile(CPluginSettings::GetTempPath(INSTALL_EXE_FILE));
- }
- else
- {
- updatePath = CPluginSettings::GetTempPath(INSTALL_MSI_FILE);
- // Delete old installer
- ::DeleteFile(CPluginSettings::GetTempPath(INSTALL_MSI_FILE));
- }
-
- CPluginDownloadDialog dlDlg;
-
- dlDlg.SetUrlAndPath(updateUrl, updatePath);
- if (dlDlg.DoModal(::GetDesktopWindow()) == IDC_INSTALLBTN)
- {
- LaunchUpdater(updatePath);
-#ifdef AUTOMATIC_SHUTDOWN
- settings->EraseTab();
- ::ExitProcess(0);
-#endif // AUTOMATIC_SHUTDOWN
- }
- }
- catch (std::runtime_error& er)
- {
- DEBUG_ERROR(er.what());
- }
- }
-#endif
// ----------------------------------------------------------------
// End loop
// ----------------------------------------------------------------
if (!IsMainThreadDone(hMainThread))
{
bool isDone = false;
DWORD sleepLoopIteration = 1;
// Sleep loop
- while (!isDone && !IsMainThreadDone(hMainThread) && !s_isPluginToBeUpdated)
+ while (!isDone && !IsMainThreadDone(hMainThread))
{
// Non-hanging sleep
Sleep(5000);
if (sleepLoopIteration++ % (TIMER_THREAD_SLEEP_USER_REGISTRATION) == 0)
{
isDone = true;
}

Powered by Google App Engine
This is Rietveld