| Index: src/plugin/passthroughapp/SinkPolicy.inl |
| =================================================================== |
| --- a/src/plugin/passthroughapp/SinkPolicy.inl |
| +++ b/src/plugin/passthroughapp/SinkPolicy.inl |
| @@ -1,20 +1,3 @@ |
| -/* |
| - * This file is part of Adblock Plus <https://adblockplus.org/>, |
| - * Copyright (C) 2006-2015 Eyeo GmbH |
| - * |
| - * Adblock Plus is free software: you can redistribute it and/or modify |
| - * it under the terms of the GNU General Public License version 3 as |
| - * published by the Free Software Foundation. |
| - * |
| - * Adblock Plus is distributed in the hope that it will be useful, |
| - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| - * GNU General Public License for more details. |
| - * |
| - * You should have received a copy of the GNU General Public License |
| - * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| - */ |
| - |
| #ifndef PASSTHROUGHAPP_SINKPOLICY_INL |
| #define PASSTHROUGHAPP_SINKPOLICY_INL |
| @@ -41,6 +24,15 @@ |
| grfPI, dwReserved); |
| } |
| +inline HRESULT NoSinkStartPolicy::OnStartEx(IUri* pUri, |
| + IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, |
| + DWORD grfPI, HANDLE_PTR dwReserved, |
| + IInternetProtocolEx* pTargetProtocol) const |
| +{ |
| + ATLASSERT(pTargetProtocol != 0); |
| + return pTargetProtocol->StartEx(pUri, pOIProtSink, pOIBindInfo, |
| + grfPI, dwReserved); |
| +} |
| // ===== CComObjectSharedRef ===== |
| @@ -387,21 +379,57 @@ |
| CComPtr<IInternetBindInfo> spBindInfo; |
| if (SUCCEEDED(hr)) |
| { |
| - hr = pSink->QueryInterface(IID_IInternetProtocolSink, reinterpret_cast<void**>(&spSink)); |
| + hr = pSink->QueryInterface(IID_IInternetProtocolSink, |
| + reinterpret_cast<void**>(&spSink)); |
| ATLASSERT(SUCCEEDED(hr) && spSink != 0); |
| } |
| if (SUCCEEDED(hr)) |
| { |
| - hr = pSink->QueryInterface(IID_IInternetBindInfo, reinterpret_cast<void**>(&spBindInfo)); |
| + hr = pSink->QueryInterface(IID_IInternetBindInfo, |
| + reinterpret_cast<void**>(&spBindInfo)); |
| ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); |
| } |
| if (SUCCEEDED(hr)) |
| { |
| - hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, dwReserved); |
| + hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, |
| + dwReserved); |
| } |
| return hr; |
| } |
| +template <class Protocol, class Sink> |
| +inline HRESULT CustomSinkStartPolicy<Protocol, Sink>::OnStartEx(IUri* pUri, |
| + IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, |
| + DWORD grfPI, HANDLE_PTR dwReserved, |
| + IInternetProtocolEx* pTargetProtocol) const |
| +{ |
| + ATLASSERT(pTargetProtocol != 0); |
| + |
| + Sink* pSink = GetSink(static_cast<const Protocol*>(this)); |
| + HRESULT hr = pSink->OnStartEx(pUri, pOIProtSink, pOIBindInfo, grfPI, |
| + dwReserved, pTargetProtocol); |
| + |
| + CComPtr<IInternetProtocolSink> spSink; |
| + CComPtr<IInternetBindInfo> spBindInfo; |
| + if (SUCCEEDED(hr)) |
| + { |
| + hr = pSink->QueryInterface(IID_IInternetProtocolSink, |
| + reinterpret_cast<void**>(&spSink)); |
| + ATLASSERT(SUCCEEDED(hr) && spSink != 0); |
| + } |
| + if (SUCCEEDED(hr)) |
| + { |
| + hr = pSink->QueryInterface(IID_IInternetBindInfo, |
| + reinterpret_cast<void**>(&spBindInfo)); |
| + ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); |
| + } |
| + if (SUCCEEDED(hr)) |
| + { |
| + hr = pTargetProtocol->StartEx(pUri, spSink, spBindInfo, grfPI, |
| + dwReserved); |
| + } |
| + return hr; |
| +} |
| template <class Protocol, class Sink> |
| inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink( |
| @@ -425,4 +453,4 @@ |
| } // end namespace PassthroughAPP |
| -#endif // PASSTHROUGHAPP_SINKPOLICY_INL |
| +#endif // PASSTHROUGHAPP_SINKPOLICY_INL |