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

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

Issue 11300014: Injecting libadblockplus into IE (Closed)
Patch Set: Created July 29, 2013, 5:30 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 #include "PluginUserSettings.h" 2 #include "PluginUserSettings.h"
3 #include <algorithm> 3 #include <algorithm>
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginClient.h" 5 #include "PluginClient.h"
6 #include "../shared/Dictionary.h" 6 #include "../shared/Dictionary.h"
7 7
8 static const CString s_GetMessage = L"GetMessage"; 8 static const CString s_GetMessage = L"GetMessage";
9 static const CString s_GetLanguageCount = L"GetLanguageCount"; 9 static const CString s_GetLanguageCount = L"GetLanguageCount";
10 static const CString s_GetLanguageByIndex = L"GetLanguageByIndex"; 10 static const CString s_GetLanguageByIndex = L"GetLanguageByIndex";
11 static const CString s_GetLanguageTitleByIndex = L"GetLanguageTitleByIndex"; 11 static const CString s_GetLanguageTitleByIndex = L"GetLanguageTitleByIndex";
12 static const CString s_SetLanguage = L"SetLanguage"; 12 static const CString s_SetLanguage = L"SetLanguage";
13 static const CString s_GetLanguage = L"GetLanguage"; 13 static const CString s_GetLanguage = L"GetLanguage";
14 static const CString s_GetWhitelistDomains = L"GetWhitelistDomains"; 14 static const CString s_GetWhitelistDomains = L"GetWhitelistDomains";
15 static const CString s_AddWhitelistDomain = L"AddWhitelistDomain"; 15 static const CString s_AddWhitelistDomain = L"AddWhitelistDomain";
16 static const CString s_RemoveWhitelistDomain = L"RemoveWhitelistDomain"; 16 static const CString s_RemoveWhitelistDomain = L"RemoveWhitelistDomain";
17 static const CString s_Require = L"require";
17 18
18 static const CString s_Methods[] = {s_GetMessage, s_GetLanguageCount, s_GetLangu ageByIndex, s_GetLanguageTitleByIndex, s_SetLanguage, s_GetLanguage, s_GetWhitel istDomains, s_AddWhitelistDomain, s_RemoveWhitelistDomain}; 19 static const CString s_Methods[] = {s_GetMessage, s_GetLanguageCount, s_GetLangu ageByIndex, s_GetLanguageTitleByIndex, s_SetLanguage, s_GetLanguage, s_GetWhitel istDomains, s_AddWhitelistDomain, s_RemoveWhitelistDomain, s_Require};
19 20
20 CPluginUserSettings::CPluginUserSettings() 21 CPluginUserSettings::CPluginUserSettings()
21 { 22 {
22 } 23 }
23 24
24 25
25 STDMETHODIMP CPluginUserSettings::QueryInterface(REFIID riid, void **ppvObj) 26 STDMETHODIMP CPluginUserSettings::QueryInterface(REFIID riid, void **ppvObj)
26 { 27 {
27 if (IID_IUnknown == riid || IID_IDispatch == riid) 28 if (IID_IUnknown == riid || IID_IDispatch == riid)
28 { 29 {
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 299
299 if (VT_BSTR != pDispparams->rgvarg[0].vt) 300 if (VT_BSTR != pDispparams->rgvarg[0].vt)
300 return DISP_E_TYPEMISMATCH; 301 return DISP_E_TYPEMISMATCH;
301 302
302 CComBSTR domain = pDispparams->rgvarg[0].bstrVal; 303 CComBSTR domain = pDispparams->rgvarg[0].bstrVal;
303 if (domain.Length()) 304 if (domain.Length())
304 { 305 {
305 settings->RemoveWhiteListedDomain((BSTR)domain); 306 settings->RemoveWhiteListedDomain((BSTR)domain);
306 } 307 }
307 } 308 }
309 else if (s_Require == method)
310 {
311 if (1 != pDispparams->cArgs)
312 return DISP_E_BADPARAMCOUNT;
313
314 if (VT_BSTR != pDispparams->rgvarg[0].vt)
315 return DISP_E_TYPEMISMATCH;
316
317 pVarResult->vt = VT_BSTR;
318 CComBSTR name = pDispparams->rgvarg[0].bstrVal;
319 if (name.Length())
320 {
321 pVarResult->bstrVal = SysAllocString(settings->GetRequire(std::wstring(nam e)));
322 }
323 else
324 {
325 pVarResult->bstrVal = SysAllocString(L"");
326 }
327 }
308 else 328 else
309 return DISP_E_MEMBERNOTFOUND; 329 return DISP_E_MEMBERNOTFOUND;
310 330
311 return S_OK; 331 return S_OK;
312 } 332 }
313 333
OLDNEW

Powered by Google App Engine
This is Rietveld