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

Unified Diff: src/plugin/PluginSettings.cpp

Issue 29330618: Issue #1234 - Eliminate CString from PluginSettings.* and PluginUserSettings.* (Closed)
Patch Set: Created Nov. 20, 2015, 6:37 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/PluginSettings.cpp
===================================================================
--- a/src/plugin/PluginSettings.cpp
+++ b/src/plugin/PluginSettings.cpp
@@ -25,9 +25,9 @@
namespace
{
- std::wstring CreateDomainWhitelistingFilter(const CString& domain)
+ std::wstring CreateDomainWhitelistingFilter(const std::wstring& domain)
{
- return L"@@||" + ToWstring(domain) + L"^$document";
+ return L"@@||" + domain + L"^$document";
}
}
@@ -95,15 +95,15 @@
return GetPluginEnabled();
}
-std::map<CString, CString> CPluginSettings::GetFilterLanguageTitleList() const
+std::map<std::wstring, std::wstring> CPluginSettings::GetFilterLanguageTitleList() const
{
- std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstance()->FetchAvailableSubscriptions();
+ auto subscriptions = CPluginClient::GetInstance()->FetchAvailableSubscriptions();
- std::map<CString, CString> filterList;
+ std::map<std::wstring, std::wstring> filterList;
for (size_t i = 0; i < subscriptions.size(); i ++)
{
- SubscriptionDescription it = subscriptions[i];
- filterList.insert(std::make_pair(CString(it.url.c_str()), CString(it.title.c_str())));
+ auto it = subscriptions[i];
+ filterList.insert(std::make_pair(it.url,it.title));
sergei 2015/11/25 09:27:08 the space after comma is missed
Eric 2015/11/25 17:31:02 Done.
}
return filterList;
}
@@ -136,13 +136,11 @@
return CPluginClient::GetInstance()->GetPref(L"enabled", true);
}
-
void CPluginSettings::AddError(const CString& error, const CString& errorCode)
{
DEBUG_SETTINGS(L"SettingsTab::AddError error:" + error + " code:" + errorCode)
}
-
// ============================================================================
// Whitelist settings
// ============================================================================
@@ -184,13 +182,13 @@
return isRead;
}
-void CPluginSettings::AddWhiteListedDomain(const CString& domain)
+void CPluginSettings::AddWhiteListedDomain(const std::wstring& domain)
{
DEBUG_SETTINGS("SettingsWhitelist::AddWhiteListedDomain domain:" + domain)
CPluginClient::GetInstance()->AddFilter(CreateDomainWhitelistingFilter(domain));
}
-void CPluginSettings::RemoveWhiteListedDomain(const CString& domain)
+void CPluginSettings::RemoveWhiteListedDomain(const std::wstring& domain)
{
DEBUG_SETTINGS("SettingsWhitelist::RemoveWhiteListedDomain domain:" + domain)
CPluginClient::GetInstance()->RemoveFilter(CreateDomainWhitelistingFilter(domain));
@@ -248,27 +246,17 @@
RefreshWhitelist();
}
-CString CPluginSettings::GetSubscription()
+std::wstring CPluginSettings::GetSubscription()
{
- std::vector<SubscriptionDescription> subscriptions = CPluginClient::GetInstance()->GetListedSubscriptions();
+ auto subscriptions = CPluginClient::GetInstance()->GetListedSubscriptions();
std::wstring aaUrl = CPluginClient::GetInstance()->GetPref(L"subscriptions_exceptionsurl", L"");
- for (std::vector<SubscriptionDescription>::iterator subscription = subscriptions.begin(); subscription != subscriptions.end(); subscription++)
+ for (auto subscription = subscriptions.begin(); subscription != subscriptions.end(); subscription++)
{
if (subscription->url != aaUrl)
{
- return CString(subscription->url.c_str());
+ return subscription->url;
}
}
- return CString(L"");
+ return std::wstring();
}
-
-CString CPluginSettings::GetAppLocale()
-{
- return ToCString(GetBrowserLanguage());
-}
-
-CString CPluginSettings::GetDocumentationLink()
-{
- return CString(CPluginClient::GetInstance()->GetDocumentationLink().c_str());
-}

Powered by Google App Engine
This is Rietveld