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

Unified Diff: src/plugin/PluginClientBase.cpp

Issue 5750789393874944: [IE] First round of ATL removal (Closed)
Patch Set: Created June 20, 2014, 9:22 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/PluginClientBase.cpp
===================================================================
--- a/src/plugin/PluginClientBase.cpp
+++ b/src/plugin/PluginClientBase.cpp
@@ -12,6 +12,10 @@
#include "PluginClass.h"
#include "PluginClientBase.h"
+#include "PluginUtil.h"
+
+#include <ostream>
+#include <iomanip>
// IP adapter
#pragma comment(lib, "IPHLPAPI.lib")
@@ -40,49 +44,33 @@
}
-bool CPluginClientBase::IsValidDomain(const CString& domain)
+bool CPluginClientBase::IsValidDomain(const std::wstring & domain)
{
return domain != L"about:blank" &&
domain != L"about:tabs" &&
- domain.Find(L"javascript:") != 0 &&
- !domain.IsEmpty();
+ !ABP::util::begins_with( domain, L"javascript:" ) &&
+ !domain.empty();
}
-CString& CPluginClientBase::UnescapeUrl(CString& url)
-{
- CString unescapedUrl;
- DWORD cb = 2048;
-
- if (SUCCEEDED(::UrlUnescape(url.GetBuffer(), unescapedUrl.GetBufferSetLength(cb), &cb, 0)))
- {
- unescapedUrl.ReleaseBuffer();
- unescapedUrl.Truncate(cb);
-
- url.ReleaseBuffer();
- url = unescapedUrl;
- }
-
- return url;
-}
-
-
-void CPluginClientBase::LogPluginError(DWORD errorCode, int errorId, int errorSubid, const CString& description, bool isAsync, DWORD dwProcessId, DWORD dwThreadId)
+void CPluginClientBase::LogPluginError(DWORD errorCode, int errorId, int errorSubid, const std::wstring & description, bool isAsync, DWORD dwProcessId, DWORD dwThreadId)
{
// Prevent circular references
if (CPluginSettings::HasInstance() && isAsync)
{
DEBUG_ERROR_CODE_EX(errorCode, description, dwProcessId, dwThreadId);
- CString pluginError;
- pluginError.Format(L"%2.2d%2.2d", errorId, errorSubid);
+ std::wostringstream message ;
+ message << std::setfill( L'0' );
+ message << std::setw(2) << errorId;
+ message << std::setw(2) << errorSubid;
+ std::wstring error = message.str();
- CString pluginErrorCode;
- pluginErrorCode.Format(L"%u", errorCode);
+ message = std::wostringstream();
+ message << L"0x" << std::hex << errorCode;
+ std::wstring error_code = message.str();
- CPluginSettings* settings = CPluginSettings::GetInstance();
-
- settings->AddError(pluginError, pluginErrorCode);
+ CPluginSettings::GetInstance()->AddError(error, error_code);
}
// Post error to client for later submittal
@@ -93,7 +81,7 @@
}
-void CPluginClientBase::PostPluginError(int errorId, int errorSubid, DWORD errorCode, const CString& errorDescription)
+void CPluginClientBase::PostPluginError(int errorId, int errorSubid, DWORD errorCode, const std::wstring & errorDescription)
{
s_criticalSectionLocal.Lock();
{

Powered by Google App Engine
This is Rietveld