| OLD | NEW | 
|---|
| 1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" | 
| 2 | 2 | 
| 3 #include "PluginMimeFilterClient.h" | 3 #include "PluginMimeFilterClient.h" | 
| 4 //#include "AdPluginMimeFilter.h" | 4 //#include "AdPluginMimeFilter.h" | 
| 5 #include "PluginClient.h" | 5 #include "PluginClient.h" | 
| 6 #include "PluginWbPassThrough.h" | 6 #include "PluginWbPassThrough.h" | 
| 7 | 7 | 
| 8 | 8 | 
| 9 typedef PassthroughAPP::CMetaFactory<PassthroughAPP::CComClassFactoryProtocol,WB
    Passthru> MetaFactory; | 9 typedef PassthroughAPP::CMetaFactory<PassthroughAPP::CComClassFactoryProtocol,WB
    Passthru> MetaFactory; | 
| 10 | 10 | 
| 11 | 11 | 
| 12 CPluginMimeFilterClient::CPluginMimeFilterClient() : m_classFactory(NULL), m_spC
    FHTTP(NULL) | 12 CPluginMimeFilterClient::CPluginMimeFilterClient() : m_classFactory(NULL), m_spC
    FHTTP(NULL) | 
| 13 { | 13 { | 
| 14 »       // Should only be called once | 14   // Should only be called once | 
| 15 »       // We register mime filters here | 15   // We register mime filters here | 
| 16 »       // Register asynchronous protocol | 16   // Register asynchronous protocol | 
| 17 »       CComPtr<IInternetSession> spSession; | 17   CComPtr<IInternetSession> spSession; | 
| 18 »       m_spCFHTTP = NULL; | 18   m_spCFHTTP = NULL; | 
| 19 »       HRESULT hr = ::CoInternetGetSession(0, &spSession, 0); | 19   HRESULT hr = ::CoInternetGetSession(0, &spSession, 0); | 
| 20 »       if (FAILED(hr) || !spSession) | 20   if (FAILED(hr) || !spSession) | 
| 21 »       { | 21   { | 
| 22 »       »       DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_G
    ET_INTERNET_SESSION, "MimeClient::CoInternetGetSession failed"); | 22     DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_GET_INTERNET_
    SESSION, "MimeClient::CoInternetGetSession failed"); | 
| 23 »       »       return; | 23     return; | 
| 24 »       } | 24   } | 
| 25 | 25 | 
| 26 »       hr = MetaFactory::CreateInstance(CLSID_HttpProtocol, &m_spCFHTTP); | 26   hr = MetaFactory::CreateInstance(CLSID_HttpProtocol, &m_spCFHTTP); | 
| 27 »       if (FAILED(hr) || !m_spCFHTTP) | 27   if (FAILED(hr) || !m_spCFHTTP) | 
| 28 »       { | 28   { | 
| 29 »       »       DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_C
    REATE_HTTP_INSTANCE, "MimeClient::CreateInstance failed"); | 29     DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_CREATE_HTTP_I
    NSTANCE, "MimeClient::CreateInstance failed"); | 
| 30 »       »       return; | 30     return; | 
| 31 »       } | 31   } | 
| 32 | 32 | 
| 33 »       hr = spSession->RegisterNameSpace(m_spCFHTTP, CLSID_NULL, L"http", 0, 0,
     0); | 33   hr = spSession->RegisterNameSpace(m_spCFHTTP, CLSID_HttpProtocol, L"http", 0, 
    0, 0); | 
| 34 »       if (FAILED(hr)) | 34   if (FAILED(hr)) | 
| 35 »       { | 35   { | 
| 36 »       »       DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_R
    EGISTER_HTTP_NAMESPACE, "MimeClient::RegisterNameSpace failed"); | 36     DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_REGISTER_HTTP
    _NAMESPACE, "MimeClient::RegisterNameSpace failed"); | 
| 37 »       »       return; | 37     return; | 
| 38 »       } | 38   } | 
| 39 } | 39 } | 
| 40 | 40 | 
| 41 | 41 | 
| 42 CPluginMimeFilterClient::~CPluginMimeFilterClient() | 42 CPluginMimeFilterClient::~CPluginMimeFilterClient() | 
| 43 { | 43 { | 
| 44 »       CComPtr<IInternetSession> spSession; | 44   CComPtr<IInternetSession> spSession; | 
| 45 | 45 | 
| 46 »       ::CoInternetGetSession(0, &spSession, 0); | 46   ::CoInternetGetSession(0, &spSession, 0); | 
| 47 »       if (spSession) | 47   if (spSession) | 
| 48 »       { | 48   { | 
| 49     »   spSession->UnregisterNameSpace(m_spCFHTTP, L"http"); | 49     spSession->UnregisterNameSpace(m_spCFHTTP, L"http"); | 
| 50 »       »       if (m_spCFHTTP != NULL) | 50     if (m_spCFHTTP != NULL) | 
| 51 »       »       { | 51     { | 
| 52 »       »       »       m_spCFHTTP.Release(); | 52       m_spCFHTTP.Release(); | 
| 53 »       »       »       m_spCFHTTP = NULL; | 53       m_spCFHTTP = NULL; | 
| 54 »       »       } | 54     } | 
| 55 »       } | 55   } | 
| 56 } | 56 } | 
| 57 | 57 | 
| 58 void CPluginMimeFilterClient::Unregister() | 58 void CPluginMimeFilterClient::Unregister() | 
| 59 { | 59 { | 
| 60 »       CComPtr<IInternetSession> spSession; | 60   CComPtr<IInternetSession> spSession; | 
| 61 | 61 | 
| 62 »       ::CoInternetGetSession(0, &spSession, 0); | 62   ::CoInternetGetSession(0, &spSession, 0); | 
| 63 »       if (spSession) | 63   if (spSession) | 
| 64 »       { | 64   { | 
| 65     spSession->UnregisterNameSpace(m_spCFHTTP, L"http"); | 65     spSession->UnregisterNameSpace(m_spCFHTTP, L"http"); | 
| 66 »       } | 66   } | 
| 67 } | 67 } | 
| OLD | NEW | 
|---|