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

Unified Diff: src/plugin/PluginDomTraverserBase.h

Issue 29332057: Issue #1234 - Replace CString in the traverser (Closed)
Patch Set: Created Dec. 7, 2015, 4:07 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
« no previous file with comments | « src/plugin/AdblockPlusDomTraverser.cpp ('k') | src/plugin/PluginFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginDomTraverserBase.h
===================================================================
--- a/src/plugin/PluginDomTraverserBase.h
+++ b/src/plugin/PluginDomTraverserBase.h
@@ -43,26 +43,26 @@
void TraverseHeader(bool isHeaderTraversed);
void TraverseDocument(IWebBrowser2* pBrowser, const std::wstring& domain, const std::wstring& documentName);
- void TraverseSubdocument(IWebBrowser2* pBrowser, const std::wstring& domain, const CString& documentName);
+ void TraverseSubdocument(IWebBrowser2* pBrowser, const std::wstring& domain);
virtual void ClearCache();
protected:
- virtual bool OnIFrame(IHTMLElement* pEl, const std::wstring& url, CString& indent) { return true; }
- virtual bool OnElement(IHTMLElement* pEl, const CString& tag, T* cache, bool isDebug, CString& indent) { return true; }
+ virtual bool OnIFrame(IHTMLElement* pEl, const std::wstring& url, const std::wstring& indent) { return true; }
+ virtual bool OnElement(IHTMLElement* pEl, const std::wstring& tag, T* cache, bool isDebug, const std::wstring& indent) { return true; }
virtual bool IsEnabled();
protected:
- void TraverseDocument(IWebBrowser2* pBrowser, bool isMainDoc, CString indent);
- void TraverseChild(IHTMLElement* pEl, IWebBrowser2* pBrowser, CString& indent, bool isCached=true);
+ void TraverseDocument(IWebBrowser2* pBrowser, bool isMainDoc, const std::wstring& indent);
+ void TraverseChild(IHTMLElement* pEl, IWebBrowser2* pBrowser, const std::wstring& indent, bool isCached=true);
CComAutoCriticalSection m_criticalSection;
std::wstring m_domain;
- CString m_documentName;
+ std::wstring m_documentName;
bool m_isHeaderTraversed;
@@ -71,8 +71,8 @@
int m_cacheIndexLast;
int m_cacheElementsMax;
- std::set<CString> m_cacheDocumentHasFrames;
- std::set<CString> m_cacheDocumentHasIframes;
+ std::set<std::wstring> m_cacheDocumentHasFrames;
+ std::set<std::wstring> m_cacheDocumentHasIframes;
T* m_cacheElements;
@@ -105,16 +105,16 @@
{
m_domain = domain;
- TraverseDocument(pBrowser, true, "");
+ TraverseDocument(pBrowser, true, L"");
}
template <class T>
-void CPluginDomTraverserBase<T>::TraverseSubdocument(IWebBrowser2* pBrowser, const std::wstring& domain, const CString& documentName)
+void CPluginDomTraverserBase<T>::TraverseSubdocument(IWebBrowser2* pBrowser, const std::wstring& domain)
{
m_domain = domain;
- TraverseDocument(pBrowser, false, "");
+ TraverseDocument(pBrowser, false, L"");
}
@@ -126,7 +126,7 @@
template <class T>
-void CPluginDomTraverserBase<T>::TraverseDocument(IWebBrowser2* pBrowser, bool isMainDoc, CString indent)
+void CPluginDomTraverserBase<T>::TraverseDocument(IWebBrowser2* pBrowser, bool isMainDoc, const std::wstring& indent)
{
DWORD res = WaitForSingleObject(m_tab->m_filter->hideFiltersLoadedEvent, ENGINE_STARTUP_TIMEOUT);
if (!IsEnabled()) return;
@@ -306,9 +306,8 @@
}
}
-
template <class T>
-void CPluginDomTraverserBase<T>::TraverseChild(IHTMLElement* pEl, IWebBrowser2* pBrowser, CString& indent, bool isCached)
+void CPluginDomTraverserBase<T>::TraverseChild(IHTMLElement* pEl, IWebBrowser2* pBrowser, const std::wstring& indent, bool isCached)
{
int cacheIndex = -1;
long cacheAllElementsCount = -1;
@@ -384,9 +383,7 @@
{
return;
}
-
- CString tag = bstrTag;
- tag.MakeLower();
+ std::wstring tag = ToLowerString(ToWstring(bstrTag));
// Custom OnElement
if (!OnElement(pEl, tag, &m_cacheElements[cacheIndex], false, indent))
@@ -395,7 +392,7 @@
}
// Update frame/iframe cache
- if (tag == "iframe")
+ if (tag == L"iframe")
{
m_criticalSection.Lock();
{
@@ -403,7 +400,7 @@
}
m_criticalSection.Unlock();
}
- else if (tag == "frame")
+ else if (tag == L"frame")
{
m_criticalSection.Lock();
{
@@ -440,7 +437,7 @@
CComPtr<IHTMLElement> pChildEl;
if (SUCCEEDED(pChildElDispatch->QueryInterface(&pChildEl)) && pChildEl)
{
- TraverseChild(pChildEl, pBrowser, indent + " ", isCached);
+ TraverseChild(pChildEl, pBrowser, indent + L" ", isCached);
}
}
}
« no previous file with comments | « src/plugin/AdblockPlusDomTraverser.cpp ('k') | src/plugin/PluginFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld