OLD | NEW |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginMimeFilterClient.h" | 3 #include "PluginMimeFilterClient.h" |
4 #include "PluginClient.h" | 4 #include "PluginClient.h" |
5 #include "PluginWbPassThrough.h" | 5 #include "PluginWbPassThrough.h" |
6 | 6 |
7 | 7 |
8 typedef PassthroughAPP::CMetaFactory<PassthroughAPP::CComClassFactoryProtocol,WB
Passthru> MetaFactory; | 8 typedef PassthroughAPP::CMetaFactory<PassthroughAPP::CComClassFactoryProtocol,WB
Passthru> MetaFactory; |
9 | 9 |
10 | 10 |
11 CPluginMimeFilterClient::CPluginMimeFilterClient() : m_classFactory(NULL), m_spC
FHTTP(NULL), m_spCFHTTPS(NULL) | 11 CPluginMimeFilterClient::CPluginMimeFilterClient() : m_classFactory(NULL), m_spC
FHTTP(NULL), m_spCFHTTPS(NULL) |
12 { | 12 { |
13 // Should only be called once | 13 // Should only be called once |
14 // We register mime filters here | 14 // We register mime filters here |
15 // Register asynchronous protocol | 15 // Register asynchronous protocol |
16 CComPtr<IInternetSession> spSession; | 16 CComPtr<IInternetSession> spSession; |
17 HRESULT hr = ::CoInternetGetSession(0, &spSession, 0); | 17 HRESULT hr = ::CoInternetGetSession(0, &spSession, 0); |
18 if (FAILED(hr) || !spSession) | 18 if (FAILED(hr) || !spSession) |
19 { | 19 { |
20 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_GET_INTERNET_
SESSION, "MimeClient::CoInternetGetSession failed"); | 20 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_GET_INTERNET_
SESSION, L"MimeClient::CoInternetGetSession failed"); |
21 return; | 21 return; |
22 } | 22 } |
23 | 23 |
24 hr = MetaFactory::CreateInstance(CLSID_HttpProtocol, &m_spCFHTTP); | 24 hr = MetaFactory::CreateInstance(CLSID_HttpProtocol, &m_spCFHTTP); |
25 if (FAILED(hr) || !m_spCFHTTP) | 25 if (FAILED(hr) || !m_spCFHTTP) |
26 { | 26 { |
27 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_CREATE_HTTP_I
NSTANCE, "MimeClient::CreateInstance failed"); | 27 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_CREATE_HTTP_I
NSTANCE, L"MimeClient::CreateInstance failed"); |
28 return; | 28 return; |
29 } | 29 } |
30 | 30 |
31 hr = spSession->RegisterNameSpace(m_spCFHTTP, CLSID_HttpProtocol, L"http", 0,
0, 0); | 31 hr = spSession->RegisterNameSpace(m_spCFHTTP, CLSID_HttpProtocol, L"http", 0,
0, 0); |
32 if (FAILED(hr)) | 32 if (FAILED(hr)) |
33 { | 33 { |
34 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_REGISTER_HTTP
_NAMESPACE, "MimeClient::RegisterNameSpace failed"); | 34 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_REGISTER_HTTP
_NAMESPACE, L"MimeClient::RegisterNameSpace failed"); |
35 return; | 35 return; |
36 } | 36 } |
37 | 37 |
38 hr = MetaFactory::CreateInstance(CLSID_HttpSProtocol, &m_spCFHTTPS); | 38 hr = MetaFactory::CreateInstance(CLSID_HttpSProtocol, &m_spCFHTTPS); |
39 if (FAILED(hr) || !m_spCFHTTPS) | 39 if (FAILED(hr) || !m_spCFHTTPS) |
40 { | 40 { |
41 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_CREATE_HTTPS_
INSTANCE, "MimeClient::CreateInstance failed"); | 41 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_CREATE_HTTPS_
INSTANCE, L"MimeClient::CreateInstance failed"); |
42 return; | 42 return; |
43 } | 43 } |
44 | 44 |
45 hr = spSession->RegisterNameSpace(m_spCFHTTPS, CLSID_HttpSProtocol, L"https",
0, 0, 0); | 45 hr = spSession->RegisterNameSpace(m_spCFHTTPS, CLSID_HttpSProtocol, L"https",
0, 0, 0); |
46 if (FAILED(hr)) | 46 if (FAILED(hr)) |
47 { | 47 { |
48 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_REGISTER_HTTP
S_NAMESPACE, "MimeClient::RegisterNameSpace failed"); | 48 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SESSION, PLUGIN_ERROR_SESSION_REGISTER_HTTP
S_NAMESPACE, L"MimeClient::RegisterNameSpace failed"); |
49 return; | 49 return; |
50 } | 50 } |
51 | 51 |
52 } | 52 } |
53 | 53 |
54 | 54 |
55 CPluginMimeFilterClient::~CPluginMimeFilterClient() | 55 CPluginMimeFilterClient::~CPluginMimeFilterClient() |
56 { | 56 { |
57 CComPtr<IInternetSession> spSession; | 57 CComPtr<IInternetSession> spSession; |
58 | 58 |
(...skipping 20 matching lines...) Expand all Loading... |
79 { | 79 { |
80 CComPtr<IInternetSession> spSession; | 80 CComPtr<IInternetSession> spSession; |
81 | 81 |
82 ::CoInternetGetSession(0, &spSession, 0); | 82 ::CoInternetGetSession(0, &spSession, 0); |
83 if (spSession) | 83 if (spSession) |
84 { | 84 { |
85 spSession->UnregisterNameSpace(m_spCFHTTP, L"http"); | 85 spSession->UnregisterNameSpace(m_spCFHTTP, L"http"); |
86 spSession->UnregisterNameSpace(m_spCFHTTPS, L"https"); | 86 spSession->UnregisterNameSpace(m_spCFHTTPS, L"https"); |
87 } | 87 } |
88 } | 88 } |
OLD | NEW |