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

Unified Diff: src/plugin/AdblockPlusClient.cpp

Issue 11013110: Cleanup (Closed)
Patch Set: More refactoring. Removing main thread, tab counting. Implementing SetPref and GetPref. Addressing … Created July 9, 2013, 12:59 p.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
Index: src/plugin/AdblockPlusClient.cpp
===================================================================
--- a/src/plugin/AdblockPlusClient.cpp
+++ b/src/plugin/AdblockPlusClient.cpp
@@ -384,3 +384,36 @@
DEBUG_GENERAL(e.what());
}
}
+
+void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& value)
+{
+ Communication::OutputBuffer request;
+ request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String(value);
+
+ try
+ {
+ CallAdblockPlusEngineProcedure(request);
+ }
+ catch (const std::exception& e)
+ {
+ DEBUG_GENERAL(e.what());
+ }
+}
+
+std::wstring CAdblockPlusClient::GetPref(const std::wstring& name)
+{
+ Communication::OutputBuffer request;
+ request << Communication::PROC_GET_PREF << ToUtf8String(name);
+
+ try
+ {
+ Communication::InputBuffer response = CallAdblockPlusEngineProcedure(request);
+ std::vector<std::wstring> retValue = ReadStrings(response);
+ return retValue.size() > 0 ? retValue.at(0) : L"";
Wladimir Palant 2013/07/11 12:53:10 This really shouldn't try to read a list of string
+ }
+ catch (const std::exception& e)
+ {
+ DEBUG_GENERAL(e.what());
+ return L"";
+ }
+}

Powered by Google App Engine
This is Rietveld