Index: src/plugin/AdblockPlusClient.cpp |
diff --git a/src/plugin/AdblockPlusClient.cpp b/src/plugin/AdblockPlusClient.cpp |
index 8f89c161641db37545ce082c6e50d8431c1b7847..037e049bbe9cde15dc07c0bca748f3cdc34082cb 100644 |
--- a/src/plugin/AdblockPlusClient.cpp |
+++ b/src/plugin/AdblockPlusClient.cpp |
@@ -117,15 +117,9 @@ namespace |
for (int32_t i = 0; i < count; i++) |
{ |
SubscriptionDescription description; |
- std::string url; |
- message >> url; |
- description.url = ToUtf16String(url); |
- std::string title; |
- message >> title; |
- description.title = ToUtf16String(title); |
- std::string specialization; |
- message >> specialization; |
- description.specialization = ToUtf16String(specialization); |
+ message >> description.url; |
+ message >> description.title; |
+ message >> description.specialization; |
message >> description.listed; |
result.push_back(description); |
} |
@@ -245,7 +239,7 @@ bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) |
{ |
DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str()); |
Communication::OutputBuffer request; |
- request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(url); |
+ request << Communication::PROC_IS_WHITELISTED_URL << url; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
@@ -261,7 +255,7 @@ bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url) |
bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String(url); |
+ request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << url; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
@@ -275,7 +269,7 @@ bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url) |
bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& contentType, const std::wstring& domain) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(contentType) << ToUtf8String(domain); |
+ request << Communication::PROC_MATCHES << url << contentType << domain; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
@@ -289,15 +283,15 @@ bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co |
std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const std::wstring& domain) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_GET_ELEMHIDE_SELECTORS << ToUtf8String(domain); |
+ request << Communication::PROC_GET_ELEMHIDE_SELECTORS << domain; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
return std::vector<std::wstring>(); |
- std::vector<std::string> selectors; |
+ std::vector<std::wstring> selectors; |
response >> selectors; |
- return ToUtf16Strings(selectors); |
+ return selectors; |
} |
std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscriptions() |
@@ -334,21 +328,21 @@ bool CAdblockPlusClient::IsAcceptableAdsEnabled() |
void CAdblockPlusClient::SetSubscription(const std::wstring& url) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_SET_SUBSCRIPTION << ToUtf8String(url); |
+ request << Communication::PROC_SET_SUBSCRIPTION << url; |
CallEngine(request); |
} |
void CAdblockPlusClient::AddSubscription(const std::wstring& url) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_ADD_SUBSCRIPTION << ToUtf8String(url); |
+ request << Communication::PROC_ADD_SUBSCRIPTION << url; |
CallEngine(request); |
} |
void CAdblockPlusClient::RemoveSubscription(const std::wstring& url) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_REMOVE_SUBSCRIPTION << ToUtf8String(url); |
+ request << Communication::PROC_REMOVE_SUBSCRIPTION << url; |
CallEngine(request); |
} |
@@ -364,9 +358,9 @@ std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains() |
if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response)) |
return std::vector<std::wstring>(); |
- std::vector<std::string> domains; |
+ std::vector<std::wstring> domains; |
response >> domains; |
- return ToUtf16Strings(domains); |
+ return domains; |
} |
bool CAdblockPlusClient::IsFirstRun() |
@@ -382,35 +376,35 @@ bool CAdblockPlusClient::IsFirstRun() |
void CAdblockPlusClient::AddFilter(const std::wstring& text) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_ADD_FILTER << ToUtf8String(text); |
+ request << Communication::PROC_ADD_FILTER << text; |
CallEngine(request); |
} |
void CAdblockPlusClient::RemoveFilter(const std::wstring& text) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_REMOVE_FILTER << ToUtf8String(text); |
+ request << Communication::PROC_REMOVE_FILTER << text; |
CallEngine(request); |
} |
void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& value) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String(value); |
+ request << Communication::PROC_SET_PREF << name << value; |
CallEngine(request); |
} |
void CAdblockPlusClient::SetPref(const std::wstring& name, const int64_t & value) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_SET_PREF << ToUtf8String(name) << value; |
+ request << Communication::PROC_SET_PREF << name << value; |
CallEngine(request); |
} |
void CAdblockPlusClient::SetPref(const std::wstring& name, bool value) |
{ |
Communication::OutputBuffer request; |
- request << Communication::PROC_SET_PREF << ToUtf8String(name) << value; |
+ request << Communication::PROC_SET_PREF << name << value; |
CallEngine(request); |
} |
@@ -422,7 +416,7 @@ std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const std::ws |
{ |
DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); |
Communication::OutputBuffer request; |
- request << Communication::PROC_GET_PREF << ToUtf8String(name); |
+ request << Communication::PROC_GET_PREF << name; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
@@ -431,10 +425,10 @@ std::wstring CAdblockPlusClient::GetPref(const std::wstring& name, const std::ws |
response >> success; |
if (success) |
{ |
- std::string value; |
+ std::wstring value; |
response >> value; |
DEBUG_GENERAL((L"GetPref: " + name + L" end").c_str()); |
- return ToUtf16String(value); |
+ return value; |
} |
else |
{ |
@@ -447,7 +441,7 @@ bool CAdblockPlusClient::GetPref(const std::wstring& name, bool defaultValue) |
{ |
DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); |
Communication::OutputBuffer request; |
- request << Communication::PROC_GET_PREF << ToUtf8String(name); |
+ request << Communication::PROC_GET_PREF << name; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
@@ -471,7 +465,7 @@ int64_t CAdblockPlusClient::GetPref(const std::wstring& name, int64_t defaultVal |
{ |
DEBUG_GENERAL((L"GetPref: " + name + L" start").c_str()); |
Communication::OutputBuffer request; |
- request << Communication::PROC_GET_PREF << ToUtf8String(name); |
+ request << Communication::PROC_GET_PREF << name; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
@@ -505,9 +499,9 @@ std::wstring CAdblockPlusClient::GetDocumentationLink() |
Communication::InputBuffer response; |
if (!CallEngine(Communication::PROC_GET_DOCUMENTATION_LINK, response)) |
return L""; |
- std::string docLink; |
+ std::wstring docLink; |
response >> docLink; |
- return ToUtf16String(docLink); |
+ return docLink; |
} |
bool CAdblockPlusClient::TogglePluginEnabled() |
@@ -525,21 +519,21 @@ std::wstring CAdblockPlusClient::GetHostFromUrl(const std::wstring& url) |
{ |
DEBUG_GENERAL("GetHostFromUrl"); |
Communication::OutputBuffer request; |
- request << Communication::PROC_GET_HOST << ToUtf8String(url); |
+ request << Communication::PROC_GET_HOST << url; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
return L""; |
- std::string host; |
+ std::wstring host; |
response >> host; |
- return ToUtf16String(host); |
+ return host; |
} |
int CAdblockPlusClient::CompareVersions(const std::wstring& v1, const std::wstring& v2) |
{ |
DEBUG_GENERAL("CompareVersions"); |
Communication::OutputBuffer request; |
- request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8String(v2); |
+ request << Communication::PROC_COMPARE_VERSIONS << v1 << v2; |
Communication::InputBuffer response; |
if (!CallEngine(request, response)) |
return 0; |