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

Side by Side Diff: src/plugin/PluginClass.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 "PluginClass.h" 3 #include "PluginClass.h"
4 #include "PluginDictionary.h" 4 #include "PluginDictionary.h"
5 #include "PluginSettings.h" 5 #include "PluginSettings.h"
6 #include "PluginSystem.h" 6 #include "PluginSystem.h"
7 #ifdef SUPPORT_FILTER 7 #ifdef SUPPORT_FILTER
8 #include "PluginFilter.h" 8 #include "PluginFilter.h"
9 #endif 9 #endif
10 #include "PluginMimeFilterClient.h" 10 #include "PluginMimeFilterClient.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal; 43 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal;
44 CComAutoCriticalSection CPluginClass::s_criticalSectionBrowser; 44 CComAutoCriticalSection CPluginClass::s_criticalSectionBrowser;
45 CComAutoCriticalSection CPluginClass::s_criticalSectionWindow; 45 CComAutoCriticalSection CPluginClass::s_criticalSectionWindow;
46 46
47 CComQIPtr<IWebBrowser2> CPluginClass::s_asyncWebBrowser2; 47 CComQIPtr<IWebBrowser2> CPluginClass::s_asyncWebBrowser2;
48 48
49 #ifdef SUPPORT_WHITELIST 49 #ifdef SUPPORT_WHITELIST
50 std::map<UINT,CString> CPluginClass::s_menuDomains; 50 std::map<UINT,CString> CPluginClass::s_menuDomains;
51 #endif 51 #endif
52 52
53 bool CPluginClass::s_isPluginToBeUpdated = false;
54
55 CPluginTab* CPluginClass::s_activeTab = NULL; 53 CPluginTab* CPluginClass::s_activeTab = NULL;
56 54
57 55
58 CPluginClass::CPluginClass() 56 CPluginClass::CPluginClass()
59 { 57 {
60 //Use this line to debug memory leaks 58 //Use this line to debug memory leaks
61 // _CrtDumpMemoryLeaks(); 59 // _CrtDumpMemoryLeaks();
62 60
63 m_isAdviced = false; 61 m_isAdviced = false;
64 m_nConnectionID = 0; 62 m_nConnectionID = 0;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // First run or deleted settings file (dictionary version = 1) 94 // First run or deleted settings file (dictionary version = 1)
97 if (settings->GetString(SETTING_DICTIONARY_VERSION, L"1").Compare(L"1") == 0 ) 95 if (settings->GetString(SETTING_DICTIONARY_VERSION, L"1").Compare(L"1") == 0 )
98 { 96 {
99 settings->SetFirstRun(); 97 settings->SetFirstRun();
100 } 98 }
101 99
102 // Update? 100 // Update?
103 CString oldVersion = settings->GetString(SETTING_PLUGIN_VERSION); 101 CString oldVersion = settings->GetString(SETTING_PLUGIN_VERSION);
104 if (settings->IsFirstRunUpdate() || settings->GetString(SETTING_PLUGIN_UPDAT E_VERSION) == IEPLUGIN_VERSION || oldVersion != IEPLUGIN_VERSION) 102 if (settings->IsFirstRunUpdate() || settings->GetString(SETTING_PLUGIN_UPDAT E_VERSION) == IEPLUGIN_VERSION || oldVersion != IEPLUGIN_VERSION)
105 { 103 {
106 settings->SetString(SETTING_PLUGIN_VERSION, IEPLUGIN_VERSION); 104 settings->SetString(SETTING_PLUGIN_VERSION, IEPLUGIN_VERSION);
Oleksandr 2013/06/07 08:37:44 Looks like the whole "if" can be removed here. We
Wladimir Palant 2013/06/07 12:46:56 Yep, lots of code can be removed here - I am just
107 105
108 settings->Remove(SETTING_PLUGIN_UPDATE_TIME);
109 settings->Remove(SETTING_PLUGIN_UPDATE_VERSION);
110 settings->Remove(SETTING_PLUGIN_UPDATE_URL);
111
112 settings->SetFirstRunUpdate(); 106 settings->SetFirstRunUpdate();
113 } 107 }
114 108
115 int info = settings->GetValue(SETTING_PLUGIN_INFO_PANEL, 0); 109 int info = settings->GetValue(SETTING_PLUGIN_INFO_PANEL, 0);
116 110
117 #ifdef ENABLE_DEBUG_RESULT 111 #ifdef ENABLE_DEBUG_RESULT
118 CPluginDebug::DebugResultClear(); 112 CPluginDebug::DebugResultClear();
119 #endif 113 #endif
120 114
121 #ifdef ENABLE_DEBUG_INFO 115 #ifdef ENABLE_DEBUG_INFO
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 // Display menu 1362 // Display menu
1369 nMenuFlags |= TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON; 1363 nMenuFlags |= TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON;
1370 1364
1371 int nCommand = ::TrackPopupMenu(hMenu, nMenuFlags, pt.x, pt.y, 0, hMenuWnd, 0) ; 1365 int nCommand = ::TrackPopupMenu(hMenu, nMenuFlags, pt.x, pt.y, 0, hMenuWnd, 0) ;
1372 1366
1373 ::DestroyMenu(hMenu); 1367 ::DestroyMenu(hMenu);
1374 ::DestroyWindow(hMenuWnd); 1368 ::DestroyWindow(hMenuWnd);
1375 1369
1376 switch (nCommand) 1370 switch (nCommand)
1377 { 1371 {
1378 case ID_PLUGIN_UPDATE:
1379 {
1380 s_isPluginToBeUpdated = true;
1381 }
1382 break;
1383
1384 case ID_PLUGIN_ENABLE: 1372 case ID_PLUGIN_ENABLE:
1385 { 1373 {
1386 CPluginSettings* settings = CPluginSettings::GetInstance(); 1374 CPluginSettings* settings = CPluginSettings::GetInstance();
1387 1375
1388 settings->TogglePluginEnabled(); 1376 settings->TogglePluginEnabled();
1389 1377
1390 // Enable / disable mime filter 1378 // Enable / disable mime filter
1391 s_criticalSectionLocal.Lock(); 1379 s_criticalSectionLocal.Lock();
1392 { 1380 {
1393 if (settings->GetPluginEnabled()) 1381 if (settings->GetPluginEnabled())
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 1499
1512 CPluginClient* client = CPluginClient::GetInstance(); 1500 CPluginClient* client = CPluginClient::GetInstance();
1513 1501
1514 CPluginSettings* settings = CPluginSettings::GetInstance(); 1502 CPluginSettings* settings = CPluginSettings::GetInstance();
1515 1503
1516 settings->RefreshTab(); 1504 settings->RefreshTab();
1517 1505
1518 // Update settings 1506 // Update settings
1519 m_tab->OnUpdateSettings(false); 1507 m_tab->OnUpdateSettings(false);
1520 1508
1521 // Plugin update
1522 if (settings->IsPluginUpdateAvailable())
1523 {
1524 ctext = dictionary->Lookup("MENU_UPDATE");
1525 fmii.fMask = MIIM_STATE | MIIM_STRING;
1526 fmii.fState = MFS_ENABLED;
1527 fmii.dwTypeData = ctext.GetBuffer();
1528 fmii.cch = ctext.GetLength();
1529 ::SetMenuItemInfo(hMenu, ID_PLUGIN_UPDATE, FALSE, &fmii);
1530 }
1531 else
1532 {
1533 ::DeleteMenu(hMenu, ID_PLUGIN_UPDATE, FALSE);
1534 }
1535 #ifdef SUPPORT_WHITELIST 1509 #ifdef SUPPORT_WHITELIST
1536 { 1510 {
1537 // White list domain 1511 // White list domain
1538 ctext = dictionary->Lookup("MENU_DISABLE_ON"); 1512 ctext = dictionary->Lookup("MENU_DISABLE_ON");
1539 fmii.fMask = MIIM_STRING | MIIM_STATE; 1513 fmii.fMask = MIIM_STRING | MIIM_STATE;
1540 fmii.fState = MFS_DISABLED; 1514 fmii.fState = MFS_DISABLED;
1541 fmii.dwTypeData = ctext.GetBuffer(); 1515 fmii.dwTypeData = ctext.GetBuffer();
1542 fmii.cch = ctext.GetLength(); 1516 fmii.cch = ctext.GetLength();
1543 1517
1544 UINT index = WM_WHITELIST_DOMAIN; 1518 UINT index = WM_WHITELIST_DOMAIN;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 } 2187 }
2214 } 2188 }
2215 } 2189 }
2216 2190
2217 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 2191 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
2218 } 2192 }
2219 2193
2220 return hTabWnd; 2194 return hTabWnd;
2221 2195
2222 } 2196 }
OLDNEW

Powered by Google App Engine
This is Rietveld