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

Unified Diff: src/plugin/PluginUserSettings.cpp

Issue 5427527162003456: Issue 1086 - Add acceptable ads checkbox to the settings page (Closed)
Patch Set: Created July 21, 2014, 11:42 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
« html/templates/index.html ('K') | « src/plugin/PluginClass.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginUserSettings.cpp
===================================================================
--- a/src/plugin/PluginUserSettings.cpp
+++ b/src/plugin/PluginUserSettings.cpp
@@ -16,8 +16,9 @@
static const CString s_RemoveWhitelistDomain = L"RemoveWhitelistDomain";
static const CString s_GetAppLocale = L"GetAppLocale";
static const CString s_GetDocumentationLink = L"GetDocumentationLink";
-
-static const CString s_Methods[] = {s_GetMessage, s_GetLanguageCount, s_GetLanguageByIndex, s_GetLanguageTitleByIndex, s_SetLanguage, s_GetLanguage, s_GetWhitelistDomains, s_AddWhitelistDomain, s_RemoveWhitelistDomain, s_GetAppLocale, s_GetDocumentationLink};
+static const CString s_IsAcceptableAdsEnabled = L"IsAcceptableAdsEnabled";
+static const CString s_SetAcceptableAdsEnabled = L"SetAcceptableAdsEnabled";
+static const CString s_Methods[] = {s_GetMessage, s_GetLanguageCount, s_GetLanguageByIndex, s_GetLanguageTitleByIndex, s_SetLanguage, s_GetLanguage, s_GetWhitelistDomains, s_AddWhitelistDomain, s_RemoveWhitelistDomain, s_GetAppLocale, s_GetDocumentationLink, s_IsAcceptableAdsEnabled, s_SetAcceptableAdsEnabled};
CPluginUserSettings::CPluginUserSettings()
{
@@ -323,6 +324,35 @@
pVarResult->vt = VT_BSTR;
pVarResult->bstrVal = SysAllocString(settings->GetDocumentationLink());
}
+ else if (s_IsAcceptableAdsEnabled == method)
+ {
+ if (0 != pDispparams->cArgs)
Felix Dahlke 2014/07/21 13:15:37 I guess we should at some point move this whole fi
+ return DISP_E_BADPARAMCOUNT;
+
+ pVarResult->vt = VT_BOOL;
+ pVarResult->boolVal = CPluginClient::GetInstance()->IsAcceptableAdsEnabled();
+ }
+ else if (s_SetAcceptableAdsEnabled == method)
+ {
+ if (1 != pDispparams->cArgs)
+ return DISP_E_BADPARAMCOUNT;
+
+ if (VT_BOOL != pDispparams->rgvarg[0].vt)
+ return DISP_E_TYPEMISMATCH;
+
+ bool enable = pDispparams->rgvarg[0].boolVal;
+
+ if (enable)
+ {
+ CPluginClient* client = CPluginClient::GetInstance();
+ client->AddSubscription(client->GetPref(L"subscriptions_exceptionsurl", L""));
+ }
+ else
+ {
+ CPluginClient* client = CPluginClient::GetInstance();
+ client->RemoveSubscription(client->GetPref(L"subscriptions_exceptionsurl", L""));
+ }
+ }
else
return DISP_E_MEMBERNOTFOUND;
« html/templates/index.html ('K') | « src/plugin/PluginClass.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld