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: Rebased Created Oct. 21, 2014, 6:26 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/PluginFilter.cpp ('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
@@ -58,14 +58,15 @@
return CFilter::contentTypeAny;
}
-int WBPassthruSink::GetContentTypeFromURL(const CString& src)
+int WBPassthruSink::GetContentTypeFromURL(const std::wstring& src)
{
- 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('.');
@@ -99,7 +100,7 @@
return CFilter::contentTypeAny;
}
-int WBPassthruSink::GetContentType(const CString& mimeType, const std::wstring& domain, const CString& src)
+int WBPassthruSink::GetContentType(const CString& mimeType, const std::wstring& domain, const std::wstring& src)
{
// No referer or mime type
// BINDSTRING_XDR_ORIGIN works only for IE v8+
@@ -126,9 +127,9 @@
{
m_pTargetProtocol = pTargetProtocol;
bool isBlocked = false;
- CString src = szUrl;
- DEBUG_GENERAL(src);
- CPluginClient::UnescapeUrl(src);
+ std::wstring src(szUrl);
+ DEBUG_GENERAL(ToCString(src));
+ UnescapeUrl(src);
// call the impl of the base class as soon as possible because it initializes the base class
// members, used by this method. It queries for the required interfaces.
@@ -175,13 +176,13 @@
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(std::wstring(documentUrl)))
+ else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhitelistedUrl(documentUrl))
{
m_boundDomain = tab->GetDocumentUrl();
m_contentType = CFilter::contentTypeAny;
@@ -229,7 +230,7 @@
// obtain the "request type" in our terminology.
if (nullptr != client
&& CFilter::EContentType::contentTypeAny != m_contentType
- && client->ShouldBlock(static_cast<const wchar_t*>(src), m_contentType, m_boundDomain, true))
+ && client->ShouldBlock(src, m_contentType, m_boundDomain, true))
{
isBlocked = true;
}
« src/plugin/PluginFilter.cpp ('K') | « src/plugin/PluginWbPassThrough.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld