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: Created April 14, 2014, 7:01 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 "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"
11 #include "PluginClientFactory.h" 11 #include "PluginClientFactory.h"
12 #include "PluginMutex.h" 12 #include "PluginMutex.h"
13 #include "sddl.h" 13 #include "sddl.h"
14 #include "PluginUtil.h" 14 #include "PluginUtil.h"
15 #include "PluginUserSettings.h" 15 #include "PluginUserSettings.h"
16 #include "../shared/Utils.h" 16 #include "../shared/Utils.h"
17 #include "../shared/Dictionary.h" 17 #include "../shared/Dictionary.h"
18 18
19 #ifdef DEBUG_HIDE_EL 19 #ifdef DEBUG_HIDE_EL
20 DWORD profileTime = 0; 20 DWORD profileTime = 0;
21 #endif 21 #endif
22 22
Felix Dahlke 2014/06/30 17:24:04 I liked it better with just one line of whitespace
23
23 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); 24 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR);
24 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); 25 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT);
25 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); 26 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE);
26 27
27 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; 28 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL };
28 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED }; 29 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED };
29 30
30 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL; 31 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL;
31 32
32 CLOSETHEMEDATA pfnClose = NULL; 33 CLOSETHEMEDATA pfnClose = NULL;
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 if (client->IsWhitelistedUrl(std::wstring(urlString))) 1334 if (client->IsWhitelistedUrl(std::wstring(urlString)))
1334 { 1335 {
1335 settings->RemoveWhiteListedDomain(ExtractDomain(urlString)); 1336 settings->RemoveWhiteListedDomain(ExtractDomain(urlString));
1336 } 1337 }
1337 else 1338 else
1338 { 1339 {
1339 settings->AddWhiteListedDomain(ExtractDomain(urlString)); 1340 settings->AddWhiteListedDomain(ExtractDomain(urlString));
1340 } 1341 }
1341 GetBrowser()->Refresh(); 1342 GetBrowser()->Refresh();
1342 } 1343 }
1344 case ID_MENU_ACCEPTABLE_ADS:
1345 {
1346 if (client->AcceptableAdsStatus())
1347 {
1348 client->RemoveSubscription(client->GetPref(L"subscriptions_exceptionsurl ", L""));
1349 }
1350 else
1351 {
1352 client->AddSubscription(client->GetPref(L"subscriptions_exceptionsurl", L""));
1353 }
1354 }
1343 default: 1355 default:
1344 break; 1356 break;
1345 } 1357 }
1346 1358
1347 // Invalidate and redraw the control 1359 // Invalidate and redraw the control
1348 UpdateStatusBar(); 1360 UpdateStatusBar();
1349 } 1361 }
1350 1362
1351 1363
1352 bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url) 1364 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); 1442 ::SetMenuItemInfoW(hMenu, ID_MENU_DISABLE, FALSE, &fmii);
1431 1443
1432 // Settings 1444 // Settings
1433 ctext = dictionary->Lookup("menu", "menu-settings"); 1445 ctext = dictionary->Lookup("menu", "menu-settings");
1434 fmii.fMask = MIIM_STATE | MIIM_STRING; 1446 fmii.fMask = MIIM_STATE | MIIM_STRING;
1435 fmii.fState = MFS_ENABLED; 1447 fmii.fState = MFS_ENABLED;
1436 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1448 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1437 fmii.cch = static_cast<UINT>(ctext.size()); 1449 fmii.cch = static_cast<UINT>(ctext.size());
1438 ::SetMenuItemInfoW(hMenu, ID_MENU_SETTINGS, FALSE, &fmii); 1450 ::SetMenuItemInfoW(hMenu, ID_MENU_SETTINGS, FALSE, &fmii);
1439 1451
1452 ctext = dictionary->Lookup("menu", "menu-acceptable-ads");
1453 // Are Acceptable Ads enabled?
Felix Dahlke 2014/06/30 17:24:04 This comment can also go if the function is called
1454 if (client->AcceptableAdsStatus())
1455 {
1456 fmii.fState = MFS_CHECKED | MFS_ENABLED;
1457 }
1458 else
1459 {
1460 fmii.fState = MFS_UNCHECKED | MFS_ENABLED;
1461 }
1462 fmii.fMask = MIIM_STRING | MIIM_STATE;
1463 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
1464 fmii.cch = static_cast<UINT>(ctext.size());
1465
1466 ::SetMenuItemInfoW(hMenu, ID_MENU_ACCEPTABLE_ADS, FALSE, &fmii);
1467
1468
1440 return true; 1469 return true;
1441 } 1470 }
1442 1471
1443 1472
1444 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*) 1473 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V ARIANTARG*)
1445 { 1474 {
1446 HWND hBrowserWnd = GetBrowserHWND(); 1475 HWND hBrowserWnd = GetBrowserHWND();
1447 if (!hBrowserWnd) 1476 if (!hBrowserWnd)
1448 { 1477 {
1449 return E_FAIL; 1478 return E_FAIL;
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 } 1997 }
1969 } 1998 }
1970 } 1999 }
1971 2000
1972 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 2001 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1973 } 2002 }
1974 2003
1975 return hTabWnd; 2004 return hTabWnd;
1976 2005
1977 } 2006 }
OLDNEW

Powered by Google App Engine
This is Rietveld