OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // ===== CustomSinkStartPolicy ===== | 372 // ===== CustomSinkStartPolicy ===== |
373 | 373 |
374 template <class Protocol, class Sink> | 374 template <class Protocol, class Sink> |
375 inline HRESULT CustomSinkStartPolicy<Protocol, Sink>::OnStart(LPCWSTR szUrl, | 375 inline HRESULT CustomSinkStartPolicy<Protocol, Sink>::OnStart(LPCWSTR szUrl, |
376 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, | 376 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, |
377 DWORD grfPI, HANDLE_PTR dwReserved, | 377 DWORD grfPI, HANDLE_PTR dwReserved, |
378 IInternetProtocol* pTargetProtocol) | 378 IInternetProtocol* pTargetProtocol) |
379 { | 379 { |
380 ATLASSERT(pTargetProtocol != 0); | 380 ATLASSERT(pTargetProtocol != 0); |
381 | 381 |
382 bool handled = false; | |
383 Sink* pSink = GetSink(static_cast<const Protocol*>(this)); | 382 Sink* pSink = GetSink(static_cast<const Protocol*>(this)); |
384 HRESULT hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, | 383 HRESULT hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, |
385 » » dwReserved, pTargetProtocol, handled); | 384 » » dwReserved, pTargetProtocol); |
386 | 385 |
387 CComPtr<IInternetProtocolSink> spSink; | 386 CComPtr<IInternetProtocolSink> spSink; |
388 CComPtr<IInternetBindInfo> spBindInfo; | 387 CComPtr<IInternetBindInfo> spBindInfo; |
389 if (SUCCEEDED(hr)) | 388 if (SUCCEEDED(hr)) |
390 { | 389 { |
391 hr = pSink->QueryInterface(IID_IInternetProtocolSink, reinterpre
t_cast<void**>(&spSink)); | 390 hr = pSink->QueryInterface(IID_IInternetProtocolSink, reinterpre
t_cast<void**>(&spSink)); |
392 ATLASSERT(SUCCEEDED(hr) && spSink != 0); | 391 ATLASSERT(SUCCEEDED(hr) && spSink != 0); |
393 } | 392 } |
394 if (SUCCEEDED(hr)) | 393 if (SUCCEEDED(hr)) |
395 { | 394 { |
396 hr = pSink->QueryInterface(IID_IInternetBindInfo, reinterpret_ca
st<void**>(&spBindInfo)); | 395 hr = pSink->QueryInterface(IID_IInternetBindInfo, reinterpret_ca
st<void**>(&spBindInfo)); |
397 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); | 396 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); |
398 } | 397 } |
399 » if (SUCCEEDED(hr) && !handled) | 398 » if (SUCCEEDED(hr)) |
400 { | 399 { |
401 hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, dw
Reserved); | 400 hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, dw
Reserved); |
402 } | 401 } |
403 if (E_ABORT == hr && pSink->m_isCustomResponse) | 402 if (E_ABORT == hr && pSink->m_isCustomResponse) |
404 { | 403 { |
405 static_cast<Protocol*>(this)->m_shouldSupplyCustomContent = true
; | 404 static_cast<Protocol*>(this)->m_shouldSupplyCustomContent = true
; |
406 pSink->m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMET
YPEAVAILABLE, L"text/html"); | 405 pSink->m_spInternetProtocolSink->ReportProgress(BINDSTATUS_MIMET
YPEAVAILABLE, L"text/html"); |
407 pSink->m_spInternetProtocolSink->ReportData(BSCF_FIRSTDATANOTIFI
CATION, 0, static_cast<ULONG>(g_blockedByABPPage.size())); | 406 pSink->m_spInternetProtocolSink->ReportData(BSCF_FIRSTDATANOTIFI
CATION, 0, static_cast<ULONG>(g_blockedByABPPage.size())); |
408 return S_OK; | 407 return S_OK; |
409 } | 408 } |
(...skipping 17 matching lines...) Expand all Loading... |
427 template <class Protocol, class Sink> | 426 template <class Protocol, class Sink> |
428 inline Protocol* CustomSinkStartPolicy<Protocol, Sink>::GetProtocol( | 427 inline Protocol* CustomSinkStartPolicy<Protocol, Sink>::GetProtocol( |
429 const Sink* pSink) | 428 const Sink* pSink) |
430 { | 429 { |
431 return Protocol::ComObjectClass::GetProtocol(pSink); | 430 return Protocol::ComObjectClass::GetProtocol(pSink); |
432 } | 431 } |
433 | 432 |
434 } // end namespace PassthroughAPP | 433 } // end namespace PassthroughAPP |
435 | 434 |
436 #endif // PASSTHROUGHAPP_SINKPOLICY_INL | 435 #endif // PASSTHROUGHAPP_SINKPOLICY_INL |
OLD | NEW |