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

Side by Side Diff: src/plugin/passthroughapp/SinkPolicy.inl

Issue 29332980: Issue #1484 - Use the currently distributed version of PassthroughAPP unaltered
Patch Set: use OnStartEx() instead of OnStart() Created Dec. 23, 2015, 3:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef PASSTHROUGHAPP_SINKPOLICY_INL 1 #ifndef PASSTHROUGHAPP_SINKPOLICY_INL
19 #define PASSTHROUGHAPP_SINKPOLICY_INL 2 #define PASSTHROUGHAPP_SINKPOLICY_INL
20 3
21 #if _MSC_VER > 1000 4 #if _MSC_VER > 1000
22 #pragma once 5 #pragma once
23 #endif // _MSC_VER > 1000 6 #endif // _MSC_VER > 1000
24 7
25 #ifndef PASSTHROUGHAPP_SINKPOLICY_H 8 #ifndef PASSTHROUGHAPP_SINKPOLICY_H
26 #error SinkPolicy.inl requires SinkPolicy.h to be included first 9 #error SinkPolicy.inl requires SinkPolicy.h to be included first
27 #endif 10 #endif
28 11
29 namespace PassthroughAPP 12 namespace PassthroughAPP
30 { 13 {
31 14
32 // ===== NoSinkStartPolicy ===== 15 // ===== NoSinkStartPolicy =====
33 16
34 inline HRESULT NoSinkStartPolicy::OnStart(LPCWSTR szUrl, 17 inline HRESULT NoSinkStartPolicy::OnStart(LPCWSTR szUrl,
35 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, 18 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
36 DWORD grfPI, HANDLE_PTR dwReserved, 19 DWORD grfPI, HANDLE_PTR dwReserved,
37 IInternetProtocol* pTargetProtocol) const 20 IInternetProtocol* pTargetProtocol) const
38 { 21 {
39 ATLASSERT(pTargetProtocol != 0); 22 ATLASSERT(pTargetProtocol != 0);
40 return pTargetProtocol->Start(szUrl, pOIProtSink, pOIBindInfo, 23 return pTargetProtocol->Start(szUrl, pOIProtSink, pOIBindInfo,
41 grfPI, dwReserved); 24 grfPI, dwReserved);
42 } 25 }
43 26
27 inline HRESULT NoSinkStartPolicy::OnStartEx(IUri* pUri,
28 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
29 DWORD grfPI, HANDLE_PTR dwReserved,
30 IInternetProtocolEx* pTargetProtocol) const
31 {
32 ATLASSERT(pTargetProtocol != 0);
33 return pTargetProtocol->StartEx(pUri, pOIProtSink, pOIBindInfo,
34 grfPI, dwReserved);
35 }
44 36
45 // ===== CComObjectSharedRef ===== 37 // ===== CComObjectSharedRef =====
46 38
47 template<class Base> 39 template<class Base>
48 inline CComObjectSharedRef<Base>:: 40 inline CComObjectSharedRef<Base>::
49 CComObjectSharedRef(IUnknown* punkRefCount, IUnknown*) : 41 CComObjectSharedRef(IUnknown* punkRefCount, IUnknown*) :
50 m_punkRefCount(punkRefCount) 42 m_punkRefCount(punkRefCount)
51 { 43 {
52 ATLASSERT(punkRefCount != 0); 44 ATLASSERT(punkRefCount != 0);
53 } 45 }
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 ATLASSERT(pTargetProtocol != 0); 372 ATLASSERT(pTargetProtocol != 0);
381 373
382 Sink* pSink = GetSink(static_cast<const Protocol*>(this)); 374 Sink* pSink = GetSink(static_cast<const Protocol*>(this));
383 HRESULT hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, 375 HRESULT hr = pSink->OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI,
384 dwReserved, pTargetProtocol); 376 dwReserved, pTargetProtocol);
385 377
386 CComPtr<IInternetProtocolSink> spSink; 378 CComPtr<IInternetProtocolSink> spSink;
387 CComPtr<IInternetBindInfo> spBindInfo; 379 CComPtr<IInternetBindInfo> spBindInfo;
388 if (SUCCEEDED(hr)) 380 if (SUCCEEDED(hr))
389 { 381 {
390 » » hr = pSink->QueryInterface(IID_IInternetProtocolSink, reinterpre t_cast<void**>(&spSink)); 382 » » hr = pSink->QueryInterface(IID_IInternetProtocolSink,
383 » » » reinterpret_cast<void**>(&spSink));
391 ATLASSERT(SUCCEEDED(hr) && spSink != 0); 384 ATLASSERT(SUCCEEDED(hr) && spSink != 0);
392 } 385 }
393 if (SUCCEEDED(hr)) 386 if (SUCCEEDED(hr))
394 { 387 {
395 » » hr = pSink->QueryInterface(IID_IInternetBindInfo, reinterpret_ca st<void**>(&spBindInfo)); 388 » » hr = pSink->QueryInterface(IID_IInternetBindInfo,
389 » » » reinterpret_cast<void**>(&spBindInfo));
396 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0); 390 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0);
397 } 391 }
398 if (SUCCEEDED(hr)) 392 if (SUCCEEDED(hr))
399 { 393 {
400 » » hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI, dw Reserved); 394 » » hr = pTargetProtocol->Start(szUrl, spSink, spBindInfo, grfPI,
395 » » » dwReserved);
401 } 396 }
402 return hr; 397 return hr;
403 } 398 }
404 399
400 template <class Protocol, class Sink>
401 inline HRESULT CustomSinkStartPolicy<Protocol, Sink>::OnStartEx(IUri* pUri,
402 IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
403 DWORD grfPI, HANDLE_PTR dwReserved,
404 IInternetProtocolEx* pTargetProtocol) const
405 {
406 ATLASSERT(pTargetProtocol != 0);
407
408 Sink* pSink = GetSink(static_cast<const Protocol*>(this));
409 HRESULT hr = pSink->OnStartEx(pUri, pOIProtSink, pOIBindInfo, grfPI,
410 dwReserved, pTargetProtocol);
411
412 CComPtr<IInternetProtocolSink> spSink;
413 CComPtr<IInternetBindInfo> spBindInfo;
414 if (SUCCEEDED(hr))
415 {
416 hr = pSink->QueryInterface(IID_IInternetProtocolSink,
417 reinterpret_cast<void**>(&spSink));
418 ATLASSERT(SUCCEEDED(hr) && spSink != 0);
419 }
420 if (SUCCEEDED(hr))
421 {
422 hr = pSink->QueryInterface(IID_IInternetBindInfo,
423 reinterpret_cast<void**>(&spBindInfo));
424 ATLASSERT(SUCCEEDED(hr) && spBindInfo != 0);
425 }
426 if (SUCCEEDED(hr))
427 {
428 hr = pTargetProtocol->StartEx(pUri, spSink, spBindInfo, grfPI,
429 dwReserved);
430 }
431 return hr;
432 }
405 433
406 template <class Protocol, class Sink> 434 template <class Protocol, class Sink>
407 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink( 435 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink(
408 const Protocol* pProtocol) 436 const Protocol* pProtocol)
409 { 437 {
410 return Protocol::ComObjectClass::GetSink(pProtocol); 438 return Protocol::ComObjectClass::GetSink(pProtocol);
411 } 439 }
412 440
413 template <class Protocol, class Sink> 441 template <class Protocol, class Sink>
414 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink() const 442 inline Sink* CustomSinkStartPolicy<Protocol, Sink>::GetSink() const
415 { 443 {
416 return GetSink(static_cast<const Protocol*>(this)); 444 return GetSink(static_cast<const Protocol*>(this));
417 } 445 }
418 446
419 template <class Protocol, class Sink> 447 template <class Protocol, class Sink>
420 inline Protocol* CustomSinkStartPolicy<Protocol, Sink>::GetProtocol( 448 inline Protocol* CustomSinkStartPolicy<Protocol, Sink>::GetProtocol(
421 const Sink* pSink) 449 const Sink* pSink)
422 { 450 {
423 return Protocol::ComObjectClass::GetProtocol(pSink); 451 return Protocol::ComObjectClass::GetProtocol(pSink);
424 } 452 }
425 453
426 } // end namespace PassthroughAPP 454 } // end namespace PassthroughAPP
427 455
428 #endif // PASSTHROUGHAPP_SINKPOLICY_INL 456 #endif // PASSTHROUGHAPP_SINKPOLICY_INL
OLDNEW

Powered by Google App Engine
This is Rietveld