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

Unified Diff: src/plugin/PluginWbPassThrough.cpp

Issue 4912420225024000: Issue #1234 - Convert strings associated with URL's (Closed)
Patch Set: Created Oct. 14, 2014, 10:17 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
« src/plugin/PluginWbPassThrough.h ('K') | « src/plugin/PluginWbPassThrough.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginWbPassThrough.cpp
===================================================================
--- a/src/plugin/PluginWbPassThrough.cpp
+++ b/src/plugin/PluginWbPassThrough.cpp
@@ -45,14 +45,15 @@
return CFilter::contentTypeAny;
}
-int WBPassthruSink::GetContentTypeFromURL(CString src)
+int WBPassthruSink::GetContentTypeFromURL(std::wstring src)
sergei 2014/10/17 10:10:12 `const std::wstring&`
{
- CString srcExt = src;
+ CString srcLegacy = ToCString(src);
+ CString srcExt = srcLegacy;
int pos = 0;
- if ((pos = src.Find('?')) > 0)
+ if ((pos = srcLegacy.Find('?')) > 0)
{
- srcExt = src.Left(pos);
+ srcExt = srcLegacy.Left(pos);
}
int lastDotIndex = srcExt.ReverseFind('.');
@@ -90,7 +91,7 @@
}
-int WBPassthruSink::GetContentType(CString mimeType, std::wstring domain, CString src)
+int WBPassthruSink::GetContentType(CString mimeType, std::wstring domain, std::wstring src)
sergei 2014/10/17 10:10:12 const ATL::CString&, const std::wstring&
{
// No referer or mime type
// BINDSTRING_XDR_ORIGIN works only for IE v8+
@@ -120,10 +121,9 @@
bool isBlocked = false;
m_shouldBlock = false;
m_lastDataReported = false;
- CString src;
- src.Append(szUrl);
- DEBUG_GENERAL(src);
- CPluginClient::UnescapeUrl(src);
+ std::wstring src(szUrl);
+ DEBUG_GENERAL(ToCString(src));
+ UnescapeUrl(src);
std::wstring boundDomain;
CString mimeType;
@@ -165,15 +165,15 @@
if (tab && client)
{
- CString documentUrl = tab->GetDocumentUrl();
+ std::wstring documentUrl = tab->GetDocumentUrl();
// Page is identical to document => don't block
if (documentUrl == src)
{
// fall through
}
- else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhitelistedUrl(to_wstring(documentUrl)))
+ else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhitelistedUrl(documentUrl))
{
- boundDomain = to_wstring(tab->GetDocumentUrl());
+ boundDomain = tab->GetDocumentUrl();
contentType = CFilter::contentTypeAny;
if ((tab != 0) && (tab->IsFrameCached(src)))
{
@@ -183,15 +183,15 @@
{
contentType = GetContentType(mimeType, boundDomain, src);
}
- if (client->ShouldBlock(to_wstring(src), contentType, boundDomain, true))
+ if (client->ShouldBlock(src, contentType, boundDomain, true))
{
isBlocked = true;
- DEBUG_BLOCKER("Blocker::Blocking Http-request:" + src);
+ DEBUG_BLOCKER("Blocker::Blocking Http-request:" + ToCString(src));
}
}
if (!isBlocked)
{
- DEBUG_BLOCKER("Blocker::Ignoring Http-request:" + src)
+ DEBUG_BLOCKER("Blocker::Ignoring Http-request:" + ToCString(src))
}
}
@@ -199,7 +199,7 @@
if (tab == NULL)
{
contentType = GetContentType(mimeType, boundDomain, src);
- if (client->ShouldBlock(to_wstring(src), contentType, boundDomain, true))
+ if (client->ShouldBlock(src, contentType, boundDomain, true))
{
isBlocked = true;
}
« src/plugin/PluginWbPassThrough.h ('K') | « src/plugin/PluginWbPassThrough.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld