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

Delta Between Two Patch Sets: src/plugin/PluginDomTraverserBase.h

Issue 4912420225024000: Issue #1234 - Convert strings associated with URL's (Closed)
Left Patch Set: Rebased Created Oct. 21, 2014, 6:26 p.m.
Right Patch Set: Created Jan. 5, 2015, 4:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 #ifndef _PLUGIN_DOM_TRAVERSER_BASE_H_ 1 #ifndef _PLUGIN_DOM_TRAVERSER_BASE_H_
2 #define _PLUGIN_DOM_TRAVERSER_BASE_H_ 2 #define _PLUGIN_DOM_TRAVERSER_BASE_H_
3 3
4 4
5 #include "PluginTypedef.h" 5 #include "PluginTypedef.h"
6 #include "PluginTab.h" 6 #include "PluginTab.h"
7 7
8 8
9 class CPluginDomTraverserCacheBase 9 class CPluginDomTraverserCacheBase
10 { 10 {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 { 213 {
214 CComVariant vIndex(i); 214 CComVariant vIndex(i);
215 CComVariant vRetIndex; 215 CComVariant vRetIndex;
216 CComPtr<IDispatch> pFrameDispatch; 216 CComPtr<IDispatch> pFrameDispatch;
217 217
218 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch)) && pFrameDispatch) 218 if (SUCCEEDED(pFrameCollection->item(vIndex, vRetIndex, &pFrameDispatch)) && pFrameDispatch)
219 { 219 {
220 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; 220 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
221 if (pFrameBrowser) 221 if (pFrameBrowser)
222 { 222 {
223 BSTR bstrSrc;
224 std::wstring src; 223 std::wstring src;
225 if (SUCCEEDED(pFrameBrowser->get_LocationURL(&bstrSrc))) 224 CComBSTR bstrSrc;
225 if (SUCCEEDED(pFrameBrowser->get_LocationURL(&bstrSrc)) && bstrSrc)
226 { 226 {
227 src = std::wstring(bstrSrc,SysStringLen(bstrSrc)); 227 src = std::wstring(bstrSrc,SysStringLen(bstrSrc));
228 SysFreeString(bstrSrc);
229 UnescapeUrl(src); 228 UnescapeUrl(src);
230 } 229 }
231 if (!src.empty()) 230 if (!src.empty())
232 { 231 {
233 TraverseDocument(pFrameBrowser, false, indent); 232 TraverseDocument(pFrameBrowser, false, indent);
234 } 233 }
235 } 234 }
236 } 235 }
237 } 236 }
238 } 237 }
(...skipping 29 matching lines...) Expand all
268 // Some times, domain is missing. Should this be added on image src' s as well?'' 267 // Some times, domain is missing. Should this be added on image src' s as well?''
269 268
270 // eg. gadgetzone.com.au 269 // eg. gadgetzone.com.au
271 if (srcLegacy.Left(2) == L"//") 270 if (srcLegacy.Left(2) == L"//")
272 { 271 {
273 srcLegacy = L"http:" + srcLegacy; 272 srcLegacy = L"http:" + srcLegacy;
274 } 273 }
275 // eg. http://w3schools.com/html/html_examples.asp 274 // eg. http://w3schools.com/html/html_examples.asp
276 else if (srcLegacy.Left(4) != L"http" && srcLegacy.Left(6) != L"res: //") 275 else if (srcLegacy.Left(4) != L"http" && srcLegacy.Left(6) != L"res: //")
277 { 276 {
278 srcLegacy = L"http://" + to_CString(m_domain) + srcLegacy; 277 srcLegacy = L"http://" + to_CString(m_domain) + srcLegacy;
sergei 2015/01/06 13:18:18 should ToCString be instead of to_CString here?
Eric 2015/01/06 19:38:59 It's time to do a wholesale replacement, which was
Oleksandr 2015/01/13 10:08:06 Would be great to not commit to_CString anyway tho
279 } 278 }
280 std::wstring src(ToWstring(srcLegacy)); 279 std::wstring src(ToWstring(srcLegacy));
281 UnescapeUrl(src); 280 UnescapeUrl(src);
282 281
283 // Check if Iframe should be traversed 282 // Check if Iframe should be traversed
284 if (OnIFrame(pFrameEl, src, indent)) 283 if (OnIFrame(pFrameEl, src, indent))
285 { 284 {
286 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch; 285 CComQIPtr<IWebBrowser2> pFrameBrowser = pFrameDispatch;
287 if (pFrameBrowser) 286 if (pFrameBrowser)
288 { 287 {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 { 446 {
448 m_cacheIndexLast = 0; 447 m_cacheIndexLast = 0;
449 m_cacheDocumentHasFrames.clear(); 448 m_cacheDocumentHasFrames.clear();
450 m_cacheDocumentHasIframes.clear(); 449 m_cacheDocumentHasIframes.clear();
451 } 450 }
452 m_criticalSection.Unlock(); 451 m_criticalSection.Unlock();
453 } 452 }
454 453
455 454
456 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_ 455 #endif // _PLUGIN_DOM_TRAVERSER_BASE_H_
LEFTRIGHT

Powered by Google App Engine
This is Rietveld