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

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

Issue 5427527162003456: Issue 1086 - Add acceptable ads checkbox to the settings page (Closed)
Patch Set: Cosmetic fixes Created July 22, 2014, 3:56 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/AdblockPlus.rc ('k') | src/plugin/PluginUserSettings.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 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClass.h" 3 #include "PluginClass.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginSystem.h" 5 #include "PluginSystem.h"
6 #ifdef SUPPORT_FILTER 6 #ifdef SUPPORT_FILTER
7 #include "PluginFilter.h" 7 #include "PluginFilter.h"
8 #endif 8 #endif
9 #include "PluginMimeFilterClient.h" 9 #include "PluginMimeFilterClient.h"
10 #include "PluginClient.h" 10 #include "PluginClient.h"
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 if (client->IsWhitelistedUrl(std::wstring(urlString))) 1336 if (client->IsWhitelistedUrl(std::wstring(urlString)))
1337 { 1337 {
1338 settings->RemoveWhiteListedDomain(client->GetHostFromUrl(urlString.GetSt ring()).c_str()); 1338 settings->RemoveWhiteListedDomain(client->GetHostFromUrl(urlString.GetSt ring()).c_str());
1339 } 1339 }
1340 else 1340 else
1341 { 1341 {
1342 settings->AddWhiteListedDomain(client->GetHostFromUrl(urlString.GetStrin g()).c_str()); 1342 settings->AddWhiteListedDomain(client->GetHostFromUrl(urlString.GetStrin g()).c_str());
1343 } 1343 }
1344 GetBrowser()->Refresh(); 1344 GetBrowser()->Refresh();
1345 } 1345 }
1346 case ID_MENU_ACCEPTABLE_ADS:
1347 {
1348 if (client->IsAcceptableAdsEnabled())
1349 {
1350 client->RemoveSubscription(client->GetPref(L"subscriptions_exceptionsurl ", L""));
1351 }
1352 else
1353 {
1354 client->AddSubscription(client->GetPref(L"subscriptions_exceptionsurl", L""));
1355 }
1356 }
1357 default: 1346 default:
1358 break; 1347 break;
1359 } 1348 }
1360 1349
1361 // Invalidate and redraw the control 1350 // Invalidate and redraw the control
1362 UpdateStatusBar(); 1351 UpdateStatusBar();
1363 } 1352 }
1364 1353
1365 1354
1366 bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url) 1355 bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE, FALSE, &fmii); 1433 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE, FALSE, &fmii);
1445 1434
1446 // Settings 1435 // Settings
1447 ctext = dictionary->Lookup("menu", "menu-settings"); 1436 ctext = dictionary->Lookup("menu", "menu-settings");
1448 fmii.fMask = MIIM_STATE | MIIM_STRING; 1437 fmii.fMask = MIIM_STATE | MIIM_STRING;
1449 fmii.fState = MFS_ENABLED; 1438 fmii.fState = MFS_ENABLED;
1450 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1439 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1451 fmii.cch = static_cast<UINT>(ctext.size()); 1440 fmii.cch = static_cast<UINT>(ctext.size());
1452 ::SetMenuItemInfoW(hMenu, ID_MENU_SETTINGS, FALSE, &fmii); 1441 ::SetMenuItemInfoW(hMenu, ID_MENU_SETTINGS, FALSE, &fmii);
1453 1442
1454 ctext = dictionary->Lookup("menu", "menu-acceptable-ads");
1455 if (client->IsAcceptableAdsEnabled())
1456 {
1457 fmii.fState = MFS_CHECKED | MFS_ENABLED;
1458 }
1459 else
1460 {
1461 fmii.fState = MFS_UNCHECKED | MFS_ENABLED;
1462 }
1463 fmii.fMask = MIIM_STRING | MIIM_STATE;
1464 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1465 fmii.cch = static_cast<UINT>(ctext.size());
1466
1467 ::SetMenuItemInfoW(hMenu, ID_MENU_ACCEPTABLE_ADS, FALSE, &fmii);
1468
1469
1470 return true; 1443 return true;
1471 } 1444 }
1472 1445
1473 1446
1474 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*) 1447 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*)
1475 { 1448 {
1476 HWND hBrowserWnd = GetBrowserHWND(); 1449 HWND hBrowserWnd = GetBrowserHWND();
1477 if (!hBrowserWnd) 1450 if (!hBrowserWnd)
1478 { 1451 {
1479 return E_FAIL; 1452 return E_FAIL;
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 } 1971 }
1999 } 1972 }
2000 } 1973 }
2001 1974
2002 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1975 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
2003 } 1976 }
2004 1977
2005 return hTabWnd; 1978 return hTabWnd;
2006 1979
2007 } 1980 }
OLDNEW
« no previous file with comments | « src/plugin/AdblockPlus.rc ('k') | src/plugin/PluginUserSettings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld