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

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

Issue 5338025085108224: Support Acceptable Ads (Closed)
Patch Set: Missing negation fix Created July 18, 2014, 7:39 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/AdblockPlusClient.cpp ('k') | src/plugin/PluginSettings.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 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 if (client->IsWhitelistedUrl(std::wstring(urlString))) 1333 if (client->IsWhitelistedUrl(std::wstring(urlString)))
1334 { 1334 {
1335 settings->RemoveWhiteListedDomain(ExtractDomain(urlString)); 1335 settings->RemoveWhiteListedDomain(ExtractDomain(urlString));
1336 } 1336 }
1337 else 1337 else
1338 { 1338 {
1339 settings->AddWhiteListedDomain(ExtractDomain(urlString)); 1339 settings->AddWhiteListedDomain(ExtractDomain(urlString));
1340 } 1340 }
1341 GetBrowser()->Refresh(); 1341 GetBrowser()->Refresh();
1342 } 1342 }
1343 case ID_MENU_ACCEPTABLE_ADS:
1344 {
1345 if (client->IsAcceptableAdsEnabled())
1346 {
1347 client->RemoveSubscription(client->GetPref(L"subscriptions_exceptionsurl ", L""));
1348 }
1349 else
1350 {
1351 client->AddSubscription(client->GetPref(L"subscriptions_exceptionsurl", L""));
1352 }
1353 }
1343 default: 1354 default:
1344 break; 1355 break;
1345 } 1356 }
1346 1357
1347 // Invalidate and redraw the control 1358 // Invalidate and redraw the control
1348 UpdateStatusBar(); 1359 UpdateStatusBar();
1349 } 1360 }
1350 1361
1351 1362
1352 bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url) 1363 bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE, FALSE, &fmii); 1441 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE, FALSE, &fmii);
1431 1442
1432 // Settings 1443 // Settings
1433 ctext = dictionary->Lookup("menu", "menu-settings"); 1444 ctext = dictionary->Lookup("menu", "menu-settings");
1434 fmii.fMask = MIIM_STATE | MIIM_STRING; 1445 fmii.fMask = MIIM_STATE | MIIM_STRING;
1435 fmii.fState = MFS_ENABLED; 1446 fmii.fState = MFS_ENABLED;
1436 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1447 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1437 fmii.cch = static_cast<UINT>(ctext.size()); 1448 fmii.cch = static_cast<UINT>(ctext.size());
1438 ::SetMenuItemInfoW(hMenu, ID_MENU_SETTINGS, FALSE, &fmii); 1449 ::SetMenuItemInfoW(hMenu, ID_MENU_SETTINGS, FALSE, &fmii);
1439 1450
1451 ctext = dictionary->Lookup("menu", "menu-acceptable-ads");
1452 if (client->IsAcceptableAdsEnabled())
1453 {
1454 fmii.fState = MFS_CHECKED | MFS_ENABLED;
1455 }
1456 else
1457 {
1458 fmii.fState = MFS_UNCHECKED | MFS_ENABLED;
1459 }
1460 fmii.fMask = MIIM_STRING | MIIM_STATE;
1461 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1462 fmii.cch = static_cast<UINT>(ctext.size());
1463
1464 ::SetMenuItemInfoW(hMenu, ID_MENU_ACCEPTABLE_ADS, FALSE, &fmii);
1465
1466
1440 return true; 1467 return true;
1441 } 1468 }
1442 1469
1443 1470
1444 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*) 1471 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*)
1445 { 1472 {
1446 HWND hBrowserWnd = GetBrowserHWND(); 1473 HWND hBrowserWnd = GetBrowserHWND();
1447 if (!hBrowserWnd) 1474 if (!hBrowserWnd)
1448 { 1475 {
1449 return E_FAIL; 1476 return E_FAIL;
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 } 1995 }
1969 } 1996 }
1970 } 1997 }
1971 1998
1972 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1999 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1973 } 2000 }
1974 2001
1975 return hTabWnd; 2002 return hTabWnd;
1976 2003
1977 } 2004 }
OLDNEW
« no previous file with comments | « src/plugin/AdblockPlusClient.cpp ('k') | src/plugin/PluginSettings.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld