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

Side by Side Diff: src/plugin/PluginClass.cpp

Issue 5750789393874944: [IE] First round of ATL removal (Closed)
Patch Set: Created June 20, 2014, 9:22 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 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClass.h" 3 #include "PluginClass.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginSystem.h" 5 #include "PluginSystem.h"
6 #ifdef SUPPORT_FILTER 6 #ifdef SUPPORT_FILTER
7 #include "PluginFilter.h" 7 #include "PluginFilter.h"
8 #endif 8 #endif
9 #include "PluginMimeFilterClient.h" 9 #include "PluginMimeFilterClient.h"
10 #include "PluginClient.h" 10 #include "PluginClient.h"
11 #include "PluginClientFactory.h" 11 #include "PluginClientFactory.h"
12 #include "PluginMutex.h" 12 #include "PluginMutex.h"
13 #include "sddl.h" 13 #include "sddl.h"
14 #include "PluginUtil.h" 14 #include "PluginUtil.h"
15 #include "PluginUserSettings.h" 15 #include "PluginUserSettings.h"
16 #include "../shared/Utils.h" 16 #include "../shared/Utils.h"
17 #include "../shared/Dictionary.h" 17 #include "../shared/Dictionary.h"
18 #include <thread> 18 #include <thread>
19 19
20 #include "COM_Client.h"
21 #include "Wrapper.h"
22
20 #ifdef DEBUG_HIDE_EL 23 #ifdef DEBUG_HIDE_EL
21 DWORD profileTime = 0; 24 DWORD profileTime = 0;
22 #endif 25 #endif
23 26
24 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); 27 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR);
25 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); 28 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT);
26 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); 29 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE);
27 30
28 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; 31 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL };
29 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED }; 32 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED };
30 33
31 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL; 34 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL;
32 35
33 CLOSETHEMEDATA pfnClose = NULL; 36 CLOSETHEMEDATA pfnClose = NULL;
34 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; 37 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL;
35 OPENTHEMEDATA pfnOpenThemeData = NULL; 38 OPENTHEMEDATA pfnOpenThemeData = NULL;
36 39
37 ATOM CPluginClass::s_atomPaneClass = NULL; 40 ATOM CPluginClass::s_atomPaneClass = NULL;
38 HINSTANCE CPluginClass::s_hUxtheme = NULL; 41 HINSTANCE CPluginClass::s_hUxtheme = NULL;
39 CSimpleArray<CPluginClass*> CPluginClass::s_instances; 42 CSimpleArray<CPluginClass*> CPluginClass::s_instances;
40 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; 43 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances;
41 44
42 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal; 45 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal;
43 CComAutoCriticalSection CPluginClass::s_criticalSectionBrowser; 46 CComAutoCriticalSection CPluginClass::s_criticalSectionBrowser;
44 CComAutoCriticalSection CPluginClass::s_criticalSectionWindow; 47 CComAutoCriticalSection CPluginClass::s_criticalSectionWindow;
45 48
46 CComQIPtr<IWebBrowser2> CPluginClass::s_asyncWebBrowser2; 49 CComQIPtr<IWebBrowser2> CPluginClass::s_asyncWebBrowser2;
47 50
48 #ifdef SUPPORT_WHITELIST 51 #ifdef SUPPORT_WHITELIST
49 std::map<UINT,CString> CPluginClass::s_menuDomains; 52 std::map<UINT,std::wstring> CPluginClass::s_menuDomains;
50 #endif 53 #endif
51 54
52 55
53 CPluginClass::CPluginClass() 56 CPluginClass::CPluginClass()
54 { 57 {
55 //Use this line to debug memory leaks 58 //Use this line to debug memory leaks
56 // _CrtDumpMemoryLeaks(); 59 // _CrtDumpMemoryLeaks();
57 60
58 m_isAdviced = false; 61 m_isAdviced = false;
59 m_nConnectionID = 0; 62 m_nConnectionID = 0;
60 m_hTabWnd = NULL; 63 m_hTabWnd = NULL;
61 m_hStatusBarWnd = NULL; 64 m_hStatusBarWnd = NULL;
62 m_hPaneWnd = NULL; 65 m_hPaneWnd = NULL;
63 m_nPaneWidth = 0; 66 m_nPaneWidth = 0;
64 m_pWndProcStatus = NULL; 67 m_pWndProcStatus = NULL;
65 m_hTheme = NULL; 68 m_hTheme = NULL;
66 m_isInitializedOk = false; 69 m_isInitializedOk = false;
67 70
68 71
69 m_tab = new CPluginTab(this); 72 m_tab = new CPluginTab(this);
70 73
71 CPluginSystem* system = CPluginSystem::GetInstance(); 74 CPluginSystem* system = CPluginSystem::GetInstance();
72 75
73 std::wstring locale((LPCWSTR)system->GetBrowserLanguage()); 76 Dictionary::Create( system->GetBrowserLanguage() );
74 Dictionary::Create(locale);
75 } 77 }
76 78
77 CPluginClass::~CPluginClass() 79 CPluginClass::~CPluginClass()
78 { 80 {
79 delete m_tab; 81 delete m_tab;
80 } 82 }
81 83
82 84
83 ///////////////////////////////////////////////////////////////////////////// 85 /////////////////////////////////////////////////////////////////////////////
84 // Initialization 86 // Initialization
(...skipping 20 matching lines...) Expand all
105 CComQIPtr<IConnectionPointContainer, &IID_IConnectionPointContainer> pContaine r(GetBrowser()); 107 CComQIPtr<IConnectionPointContainer, &IID_IConnectionPointContainer> pContaine r(GetBrowser());
106 if (!pContainer) 108 if (!pContainer)
107 { 109 {
108 return NULL; 110 return NULL;
109 } 111 }
110 112
111 CComPtr<IConnectionPoint> pPoint; 113 CComPtr<IConnectionPoint> pPoint;
112 HRESULT hr = pContainer->FindConnectionPoint(DIID_DWebBrowserEvents2, &pPoint) ; 114 HRESULT hr = pContainer->FindConnectionPoint(DIID_DWebBrowserEvents2, &pPoint) ;
113 if (FAILED(hr)) 115 if (FAILED(hr))
114 { 116 {
115 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNEC TION_POINT, "Class::GetConnectionPoint - FindConnectionPoint") 117 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNEC TION_POINT, L"Class::GetConnectionPoint - FindConnectionPoint")
116 return NULL; 118 return NULL;
117 } 119 }
118 120
119 return pPoint; 121 return pPoint;
120 } 122 }
121 123
122 // This method tries to get a 'connection point' from the stored browser, which can be 124 // This method tries to get a 'connection point' from the stored browser, which can be
123 // used to attach or detach from the stream of browser events 125 // used to attach or detach from the stream of browser events
124 CComPtr<IConnectionPoint> CPluginClass::GetConnectionPointPropSink() 126 CComPtr<IConnectionPoint> CPluginClass::GetConnectionPointPropSink()
125 { 127 {
126 CComQIPtr<IConnectionPointContainer, &IID_IConnectionPointContainer> pContaine r(GetBrowser()); 128 CComQIPtr<IConnectionPointContainer, &IID_IConnectionPointContainer> pContaine r(GetBrowser());
127 if (!pContainer) 129 if (!pContainer)
128 { 130 {
129 return NULL; 131 return NULL;
130 } 132 }
131 133
132 CComPtr<IConnectionPoint> pPoint; 134 CComPtr<IConnectionPoint> pPoint;
133 HRESULT hr = pContainer->FindConnectionPoint(IID_IPropertyNotifySink, &pPoint) ; 135 HRESULT hr = pContainer->FindConnectionPoint(IID_IPropertyNotifySink, &pPoint) ;
134 if (FAILED(hr)) 136 if (FAILED(hr))
135 { 137 {
136 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNEC TION_POINT, "Class::GetConnectionPoint - FindConnectionPoint") 138 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNEC TION_POINT, L"Class::GetConnectionPoint - FindConnectionPoint")
137 return NULL; 139 return NULL;
138 } 140 }
139 141
140 return pPoint; 142 return pPoint;
141 } 143 }
142 144
143 145
144 HWND CPluginClass::GetBrowserHWND() const 146 HWND CPluginClass::GetBrowserHWND() const
145 { 147 {
146 SHANDLE_PTR hBrowserWndHandle = NULL; 148 SHANDLE_PTR hBrowserWndHandle = NULL;
147 149
148 CComQIPtr<IWebBrowser2> browser = GetBrowser(); 150 CComQIPtr<IWebBrowser2> browser = GetBrowser();
149 if (browser) 151 if (browser)
150 { 152 {
151 HRESULT hr = browser->get_HWND(&hBrowserWndHandle); 153 HRESULT hr = browser->get_HWND(&hBrowserWndHandle);
152 if (FAILED(hr)) 154 if (FAILED(hr))
153 { 155 {
154 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_BROWSER_WINDOW, " Class::GetBrowserHWND - failed") 156 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_BROWSER_WINDOW, L "Class::GetBrowserHWND - failed")
155 } 157 }
156 } 158 }
157 159
158 return (HWND)hBrowserWndHandle; 160 return (HWND)hBrowserWndHandle;
159 } 161 }
160 162
161 163
162 CComQIPtr<IWebBrowser2> CPluginClass::GetBrowser() const 164 CComQIPtr<IWebBrowser2> CPluginClass::GetBrowser() const
163 { 165 {
164 CComQIPtr<IWebBrowser2> browser; 166 CComQIPtr<IWebBrowser2> browser;
(...skipping 14 matching lines...) Expand all
179 181
180 s_criticalSectionLocal.Lock(); 182 s_criticalSectionLocal.Lock();
181 { 183 {
182 browser = s_asyncWebBrowser2; 184 browser = s_asyncWebBrowser2;
183 } 185 }
184 s_criticalSectionLocal.Unlock(); 186 s_criticalSectionLocal.Unlock();
185 187
186 return browser; 188 return browser;
187 } 189 }
188 190
189 CString CPluginClass::GetBrowserUrl() const 191 std::wstring CPluginClass::GetBrowserUrl() const
190 { 192 {
191 CString url; 193 std::wstring url;
192 194
193 CComQIPtr<IWebBrowser2> browser = GetBrowser(); 195 CComQIPtr<IWebBrowser2> ccom_browser = GetBrowser();
194 if (browser) 196 if (ccom_browser)
195 { 197 {
196 CComBSTR bstrURL; 198 Wrapper::Browser browser( ccom_browser );
197 199 if ( browser.Location_URL( url ) )
198 if (SUCCEEDED(browser->get_LocationURL(&bstrURL)))
199 { 200 {
200 url = bstrURL; 201 Wrapper::Unescape_URL( url );
201 CPluginClient::UnescapeUrl(url);
202 } 202 }
203 } 203 }
204 else 204 else
205 { 205 {
206 url = m_tab->GetDocumentUrl(); 206 url = m_tab->GetDocumentUrl();
207 } 207 }
208
209 return url; 208 return url;
210 } 209 }
211 210
212 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) 211 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr)
213 { 212 {
214 if (thisPtr == NULL) 213 if (thisPtr == NULL)
215 return 0; 214 return 0;
216 if (!((CPluginClass*)thisPtr)->InitObject(true)) 215 if (!((CPluginClass*)thisPtr)->InitObject(true))
217 { 216 {
218 ((CPluginClass*)thisPtr)->Unadvice(); 217 ((CPluginClass*)thisPtr)->Unadvice();
(...skipping 11 matching lines...) Expand all
230 // so we should handle that it is called this way several times during a session 229 // so we should handle that it is called this way several times during a session
231 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite) 230 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite)
232 { 231 {
233 CPluginSettings* settings = CPluginSettings::GetInstance(); 232 CPluginSettings* settings = CPluginSettings::GetInstance();
234 CPluginSystem* system = CPluginSystem::GetInstance(); 233 CPluginSystem* system = CPluginSystem::GetInstance();
235 234
236 MULTIPLE_VERSIONS_CHECK(); 235 MULTIPLE_VERSIONS_CHECK();
237 236
238 if (unknownSite) 237 if (unknownSite)
239 { 238 {
240 239 std::wstring t[] = {
241 DEBUG_GENERAL(L"============================================================ ====================\nNEW TAB UI\n============================================== ==================================") 240 L"======================================================================== ========",
241 L"NEW TAB UI",
242 L"======================================================================== ========"
243 };
244 DEBUG_GENERAL(t);
242 245
243 HRESULT hr = ::CoInitialize(NULL); 246 HRESULT hr = ::CoInitialize(NULL);
244 if (FAILED(hr)) 247 if (FAILED(hr))
245 { 248 {
246 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, " Class::SetSite - CoInitialize"); 249 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, L "Class::SetSite - CoInitialize");
247 } 250 }
248 251
249 s_criticalSectionBrowser.Lock(); 252 s_criticalSectionBrowser.Lock();
250 { 253 {
251 m_webBrowser2 = unknownSite; 254 m_webBrowser2 = unknownSite;
252 } 255 }
253 s_criticalSectionBrowser.Unlock(); 256 s_criticalSectionBrowser.Unlock();
254 257
255 //register the mimefilter 258 //register the mimefilter
256 //and only mimefilter 259 //and only mimefilter
257 //on some few computers the mimefilter does not get properly registered when it is done on another thread 260 //on some few computers the mimefilter does not get properly registered when it is done on another thread
258 261
259 s_criticalSectionLocal.Lock(); 262 s_criticalSectionLocal.Lock();
260 { 263 {
261 // Always register on startup, then check if we need to unregister in a se parate thread 264 // Always register on startup, then check if we need to unregister in a se parate thread
262 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); 265 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance();
263 s_asyncWebBrowser2 = unknownSite; 266 s_asyncWebBrowser2 = unknownSite;
264 s_instances.Add(this); 267 s_instances.Add(this);
265 } 268 }
266 s_criticalSectionLocal.Unlock(); 269 s_criticalSectionLocal.Unlock();
267 270
268 try 271 try
269 { 272 {
270 // Check if loaded as BHO 273 // Check if loaded as BHO
271 if (GetBrowser()) 274 if (GetBrowser())
272 { 275 {
273 DEBUG_GENERAL("Loaded as BHO"); 276 DEBUG_GENERAL(L"Loaded as BHO");
274 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); 277 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint();
275 if (pPoint) 278 if (pPoint)
276 { 279 {
277 HRESULT hr = pPoint->Advise((IDispatch*)this, &m_nConnectionID); 280 HRESULT hr = pPoint->Advise((IDispatch*)this, &m_nConnectionID);
278 if (SUCCEEDED(hr)) 281 if (SUCCEEDED(hr))
279 { 282 {
280 m_isAdviced = true; 283 m_isAdviced = true;
281 284
282 try 285 try
283 { 286 {
284 std::thread startInitObjectThread(StartInitObject, this); 287 std::thread startInitObjectThread(StartInitObject, this);
285 startInitObjectThread.detach(); // TODO: but actually we should wa it for the thread in the dtr. 288 startInitObjectThread.detach(); // TODO: but actually we should wa it for the thread in the dtr.
286 } 289 }
287 catch (const std::system_error& ex) 290 catch (const std::system_error& ex)
288 { 291 {
289 auto errDescription = std::string("Class::Thread - Failed to creat e StartInitObject thread, ") + 292 std::wstring errDescription( L"Class::Thread - Failed to create St artInitObject thread, " );
290 ex.code().message() + ex.what(); 293 errDescription += ABP::debug::widen( ex.code().message() + ex.what () );
291 DEBUG_ERROR_LOG(ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERR OR_MAIN_THREAD_CREATE_PROCESS, errDescription.c_str()); 294 DEBUG_ERROR_LOG( ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ER ROR_MAIN_THREAD_CREATE_PROCESS, errDescription );
292 } 295 }
293 } 296 }
294 else 297 else
295 { 298 {
296 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADV ICE, "Class::SetSite - Advice"); 299 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADV ICE, L"Class::SetSite - Advice");
297 } 300 }
298 } 301 }
299 } 302 }
300 else // Check if loaded as toolbar handler 303 else // Check if loaded as toolbar handler
301 { 304 {
302 DEBUG_GENERAL("Loaded as toolbar handler"); 305 DEBUG_GENERAL(L"Loaded as toolbar handler");
303 CComPtr<IServiceProvider> pServiceProvider; 306 CComPtr<IServiceProvider> pServiceProvider;
304 307
305 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider); 308 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider);
306 if (SUCCEEDED(hr)) 309 if (SUCCEEDED(hr))
307 { 310 {
308 if (pServiceProvider) 311 if (pServiceProvider)
309 { 312 {
310 s_criticalSectionBrowser.Lock(); 313 s_criticalSectionBrowser.Lock();
311 { 314 {
312 HRESULT hr = pServiceProvider->QueryService(IID_IWebBrowserApp, &m _webBrowser2); 315 HRESULT hr = pServiceProvider->QueryService(IID_IWebBrowserApp, &m _webBrowser2);
313 if (SUCCEEDED(hr)) 316 if (SUCCEEDED(hr))
314 { 317 {
315 if (m_webBrowser2) 318 if (m_webBrowser2)
316 { 319 {
317 InitObject(false); 320 InitObject(false);
318 } 321 }
319 } 322 }
320 else 323 else
321 { 324 {
322 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE _QUERY_BROWSER, "Class::SetSite - QueryService (IID_IWebBrowserApp)"); 325 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE _QUERY_BROWSER, L"Class::SetSite - QueryService (IID_IWebBrowserApp)");
323 } 326 }
324 } 327 }
325 s_criticalSectionBrowser.Unlock(); 328 s_criticalSectionBrowser.Unlock();
326 } 329 }
327 } 330 }
328 else 331 else
329 { 332 {
330 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY _SERVICE_PROVIDER, "Class::SetSite - QueryInterface (service provider)"); 333 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY _SERVICE_PROVIDER, L"Class::SetSite - QueryInterface (service provider)");
331 } 334 }
332 } 335 }
333 } 336 }
334 catch (std::runtime_error e) 337 catch (std::runtime_error e)
335 { 338 {
336 DEBUG_ERROR(e.what()); 339 DEBUG_ERROR(e.what());
337 Unadvice(); 340 Unadvice();
338 } 341 }
339 } 342 }
340 else 343 else
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 382 }
380 s_criticalSectionLocal.Unlock(); 383 s_criticalSectionLocal.Unlock();
381 384
382 // Release browser interface 385 // Release browser interface
383 s_criticalSectionBrowser.Lock(); 386 s_criticalSectionBrowser.Lock();
384 { 387 {
385 m_webBrowser2.Release(); 388 m_webBrowser2.Release();
386 } 389 }
387 s_criticalSectionBrowser.Unlock(); 390 s_criticalSectionBrowser.Unlock();
388 391
389 DEBUG_GENERAL("============================================================= ===================\nNEW TAB UI - END\n========================================= =======================================") 392 std::wstring t[] = {
393 L"======================================================================== ========",
394 L"NEW TAB UI - END",
395 L"======================================================================== ========"
396 };
397 DEBUG_GENERAL( t );
390 398
391 ::CoUninitialize(); 399 ::CoUninitialize();
392 } 400 }
393 401
394 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); 402 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite);
395 } 403 }
396 404
397 bool CPluginClass::IsStatusBarEnabled() 405 bool CPluginClass::IsStatusBarEnabled()
398 { 406 {
399 DEBUG_GENERAL("IsStatusBarEnabled start"); 407 DEBUG_GENERAL(L"IsStatusBarEnabled start");
400 HKEY pHkey; 408 HKEY pHkey;
401 HKEY pHkeySub; 409 HKEY pHkeySub;
402 RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey); 410 RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey);
403 DWORD trueth = 1; 411 DWORD trueth = 1;
404 DWORD truethSize = sizeof(DWORD); 412 DWORD truethSize = sizeof(DWORD);
405 RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub); 413 RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub);
406 LONG res = RegQueryValueEx(pHkeySub, L"StatusBarWeb", NULL, NULL, (BYTE*)&true th, &truethSize); 414 LONG res = RegQueryValueEx(pHkeySub, L"StatusBarWeb", NULL, NULL, (BYTE*)&true th, &truethSize);
407 RegCloseKey(pHkey); 415 RegCloseKey(pHkey);
408 if (res != ERROR_SUCCESS) 416 if (res != ERROR_SUCCESS)
409 { 417 {
410 res = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\MINIE", &p HkeySub); 418 res = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\MINIE", &p HkeySub);
411 if (res == ERROR_SUCCESS) 419 if (res == ERROR_SUCCESS)
412 { 420 {
413 LONG res = RegQueryValueEx(pHkeySub, L"ShowStatusBar", NULL, NULL, (BYTE*) &trueth, &truethSize); 421 LONG res = RegQueryValueEx(pHkeySub, L"ShowStatusBar", NULL, NULL, (BYTE*) &trueth, &truethSize);
414 if (res == ERROR_SUCCESS) 422 if (res == ERROR_SUCCESS)
415 { 423 {
416 RegCloseKey(pHkey); 424 RegCloseKey(pHkey);
417 } 425 }
418 } 426 }
419 } 427 }
420 DEBUG_GENERAL("IsStatusBarEnabled end"); 428 DEBUG_GENERAL(L"IsStatusBarEnabled end");
421 return trueth == 1; 429 return trueth == 1;
422 } 430 }
423 431
424 void CPluginClass::ShowStatusBar() 432 void CPluginClass::ShowStatusBar()
425 { 433 {
426 DEBUG_GENERAL("ShowStatusBar start"); 434 DEBUG_GENERAL(L"ShowStatusBar start");
427 435
428 VARIANT_BOOL isVisible; 436 VARIANT_BOOL isVisible;
429 437
430 438
431 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); 439 CComQIPtr<IWebBrowser2> ccom_browser = GetAsyncBrowser();
432 if (browser) 440 if (ccom_browser)
433 { 441 {
442 Wrapper::Browser browser( ccom_browser );
434 HRESULT hr = S_OK; 443 HRESULT hr = S_OK;
435 hr = browser->get_StatusBar(&isVisible); 444 hr = ccom_browser->get_StatusBar(&isVisible);
436 if (SUCCEEDED(hr)) 445 if (SUCCEEDED(hr))
437 { 446 {
438 if (!isVisible) 447 if (!isVisible)
439 { 448 {
440 SHANDLE_PTR pBrowserHWnd; 449 SHANDLE_PTR pBrowserHWnd;
441 browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd); 450 ccom_browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd);
442 Dictionary* dictionary = Dictionary::GetInstance(); 451 Dictionary* dictionary = Dictionary::GetInstance();
443 452
444 HKEY pHkey; 453 HKEY pHkey;
445 HKEY pHkeySub; 454 HKEY pHkeySub;
446 LSTATUS regRes = 0; 455 LSTATUS regRes = 0;
447 regRes = RegOpenCurrentUser(KEY_WRITE, &pHkey); 456 regRes = RegOpenCurrentUser(KEY_WRITE, &pHkey);
448 457
449 // Do we have enough rights to enable a status bar? 458 // Do we have enough rights to enable a status bar?
450 if (regRes != 0) 459 if (regRes != 0)
451 { 460 {
(...skipping 11 matching lines...) Expand all
463 MB_YESNO); 472 MB_YESNO);
464 if (res == IDYES) 473 if (res == IDYES)
465 { 474 {
466 DWORD trueth = 1; 475 DWORD trueth = 1;
467 regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\M INIE", &pHkeySub); 476 regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\M INIE", &pHkeySub);
468 regRes = RegSetValueEx(pHkeySub, L"ShowStatusBar", 0, REG_DWORD, (BYTE *)&trueth, sizeof(DWORD)); 477 regRes = RegSetValueEx(pHkeySub, L"ShowStatusBar", 0, REG_DWORD, (BYTE *)&trueth, sizeof(DWORD));
469 regRes = RegCloseKey(pHkeySub); 478 regRes = RegCloseKey(pHkeySub);
470 regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\M ain", &pHkeySub); 479 regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\M ain", &pHkeySub);
471 regRes = RegSetValueEx(pHkeySub, L"StatusBarWeb", 0, REG_DWORD, (BYTE* )&trueth, sizeof(DWORD)); 480 regRes = RegSetValueEx(pHkeySub, L"StatusBarWeb", 0, REG_DWORD, (BYTE* )&trueth, sizeof(DWORD));
472 regRes = RegCloseKey(pHkeySub); 481 regRes = RegCloseKey(pHkeySub);
473 hr = browser->put_StatusBar(TRUE); 482 hr = ccom_browser->put_StatusBar(TRUE);
474 if (FAILED(hr)) 483 if (FAILED(hr))
475 { 484 {
476 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR, "Class::Enable statusbar"); 485 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR, L"Class::Enable statusbar");
477 } 486 }
478 CreateStatusBarPane(); 487 CreateStatusBarPane();
479 488
480 // We need to restart the tab now, to enable the status bar properly 489 /*
481 VARIANT vFlags; 490 * We need to restart the tab now, to enable the status bar properly
482 vFlags.vt = VT_I4; 491 */
483 vFlags.intVal = navOpenInNewTab; 492 std::wstring location;
484 493 browser.Location_URL( location );
485 CComBSTR curLoc; 494 HRESULT hr = browser.navigate( location );
486 browser->get_LocationURL(&curLoc); 495 if ( FAILED(hr) )
487 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL);
488 if (FAILED(hr))
489 { 496 {
490 vFlags.intVal = navOpenInNewWindow; 497 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION , L"Navigation::Failed")
491
492 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL);
493 if (FAILED(hr))
494 {
495 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI ON, "Navigation::Failed")
496 }
497 } 498 }
498 browser->Quit(); 499 ccom_browser->Quit();
499 } 500 }
500 } 501 }
501 } 502 }
502 else 503 else
503 { 504 {
504 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class ::Get statusbar state"); 505 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, L"Clas s::Get statusbar state");
505 } 506 }
506 } 507 }
507 DEBUG_GENERAL("ShowStatusBar end"); 508 DEBUG_GENERAL(L"ShowStatusBar end");
508 } 509 }
509 510
510 void CPluginClass::BeforeNavigate2(DISPPARAMS* pDispParams) 511 void CPluginClass::BeforeNavigate2(DISPPARAMS* pDispParams)
511 { 512 {
512 513
513 if (pDispParams->cArgs < 7) 514 if (pDispParams->cArgs < 7)
514 { 515 {
515 return; 516 return;
516 } 517 }
517 //Register a mime filter if it's not registered yet 518 //Register a mime filter if it's not registered yet
518 if (s_mimeFilter == NULL) 519 if (s_mimeFilter == NULL)
519 { 520 {
520 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); 521 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance();
521 } 522 }
522 523
523 // Get the IWebBrowser2 interface 524 // Get the IWebBrowser2 interface
524 CComQIPtr<IWebBrowser2, &IID_IWebBrowser2> WebBrowser2Ptr; 525 CComQIPtr<IWebBrowser2, &IID_IWebBrowser2> WebBrowser2Ptr;
525 VARTYPE vt = pDispParams->rgvarg[6].vt; 526 VARTYPE vt = pDispParams->rgvarg[6].vt;
526 if (vt == VT_DISPATCH) 527 if (vt == VT_DISPATCH)
527 { 528 {
529 // The implementation of this assignment operator contains the QueryInterfac e call.
528 WebBrowser2Ptr = pDispParams->rgvarg[6].pdispVal; 530 WebBrowser2Ptr = pDispParams->rgvarg[6].pdispVal;
529 } 531 }
530 else 532 else
531 { 533 {
532 // Wrong type, return. 534 // Wrong type, return.
533 return; 535 return;
534 } 536 }
535 537
536 // Get the URL 538 // Get the URL
537 CString url; 539 std::wstring url;
538 vt = pDispParams->rgvarg[5].vt; 540 vt = pDispParams->rgvarg[5].vt;
539 if (vt == VT_BYREF + VT_VARIANT) 541 if (vt == VT_BYREF + VT_VARIANT)
540 { 542 {
541 url = pDispParams->rgvarg[5].pvarVal->bstrVal; 543 url = pDispParams->rgvarg[5].pvarVal->bstrVal;
542 544 Wrapper::Unescape_URL( url );
543 CPluginClient::UnescapeUrl(url);
544 } 545 }
545 else 546 else
546 { 547 {
547 // Wrong type, return. 548 // Wrong type, return.
548 return; 549 return;
549 } 550 }
550 551
551 // If webbrowser2 is equal to top level browser (as set in SetSite), we are na vigating new page 552 // If webbrowser2 is equal to top level browser (as set in SetSite), we are na vigating new page
552 CPluginClient* client = CPluginClient::GetInstance(); 553 CPluginClient* client = CPluginClient::GetInstance();
553 554
554 if (url.Find(L"javascript") == 0) 555 // This comparison means "begins with"
556 if ( url.compare( 0, 10, L"javascript" ) == 0 )
555 { 557 {
556 } 558 }
557 else if (GetBrowser().IsEqualObject(WebBrowser2Ptr)) 559 else if (GetBrowser().IsEqualObject(WebBrowser2Ptr))
558 { 560 {
559 m_tab->OnNavigate(url); 561 m_tab->OnNavigate( url );
560 562
561 DEBUG_GENERAL(L"============================================================ ====================\nBegin main navigation url:" + url + "\n=================== =============================================================") 563 std::wstring t[] = {
564 L"======================================================================== ========",
565 L"Begin main navigation url:" + url,
566 L"======================================================================== ========"
567 };
568 DEBUG_GENERAL( t );
562 569
563 #ifdef ENABLE_DEBUG_RESULT 570 #ifdef ENABLE_DEBUG_RESULT
564 CPluginDebug::DebugResultDomain(url); 571 CPluginDebug::DebugResultDomain( url );
565 #endif 572 #endif
566 573
567 UpdateStatusBar(); 574 UpdateStatusBar();
568 } 575 }
569 else 576 else
570 { 577 {
571 DEBUG_NAVI(L"Navi::Begin navigation url:" + url) 578 DEBUG_NAVI(L"Navi::Begin navigation url:" + url)
572 579
573 #ifdef SUPPORT_FRAME_CACHING 580 #ifdef SUPPORT_FRAME_CACHING
574 m_tab->CacheFrame(url); 581 m_tab->CacheFrame( url );
575 #endif 582 #endif
576 } 583 }
577 } 584 }
578 STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags) 585 STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags)
579 { 586 {
580 DEBUG_GENERAL("Tab changed"); 587 DEBUG_GENERAL(L"Tab changed");
581 bool newtabshown = pDispParams->rgvarg[1].intVal==3; 588 bool newtabshown = pDispParams->rgvarg[1].intVal==3;
582 if (newtabshown) 589 if (newtabshown)
583 { 590 {
584 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId()); 591 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(Ge tCurrentThreadId());
585 if (it == s_threadInstances.end()) 592 if (it == s_threadInstances.end())
586 { 593 {
587 s_threadInstances[::GetCurrentThreadId()] = this; 594 s_threadInstances[::GetCurrentThreadId()] = this;
588 595
589 596
590 if (!m_isInitializedOk) 597 if (!m_isInitializedOk)
591 { 598 {
592 m_isInitializedOk = true; 599 m_isInitializedOk = true;
593 if (!InitObject(true)) 600 if (!InitObject(true))
594 { 601 {
595 // Unadvice(); 602 // Unadvice();
596 } 603 }
597 UpdateStatusBar(); 604 UpdateStatusBar();
598 } 605 }
599 } 606 }
600 } 607 }
601 notificationMessage.Hide(); 608 notificationMessage.Hide();
602 DEBUG_GENERAL("Tab change end"); 609 DEBUG_GENERAL(L"Tab change end");
603 return VARIANT_TRUE; 610 return VARIANT_TRUE;
604 } 611 }
605 612
606 // This gets called whenever there's a browser event 613 // This gets called whenever there's a browser event
607 STDMETHODIMP CPluginClass::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, W ORD wFlags, DISPPARAMS* pDispParams, VARIANT* pvarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) 614 STDMETHODIMP CPluginClass::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, W ORD wFlags, DISPPARAMS* pDispParams, VARIANT* pvarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
608 { 615 {
609 WCHAR tmp[256]; 616 WCHAR tmp[256];
610 wsprintf(tmp, L"Invoke: %d\n", dispidMember); 617 wsprintf(tmp, L"Invoke: %d\n", dispidMember);
611 DEBUG_GENERAL(tmp); 618 DEBUG_GENERAL(tmp);
612 switch (dispidMember) 619 switch (dispidMember)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 { 700 {
694 m_tab->OnDownloadComplete(browser); 701 m_tab->OnDownloadComplete(browser);
695 } 702 }
696 } 703 }
697 break; 704 break;
698 705
699 case DISPID_DOCUMENTCOMPLETE: 706 case DISPID_DOCUMENTCOMPLETE:
700 { 707 {
701 DEBUG_NAVI("Navi::Document Complete") 708 DEBUG_NAVI("Navi::Document Complete")
702 709
703 CComQIPtr<IWebBrowser2> browser = GetBrowser(); 710 CComQIPtr<IWebBrowser2> ccom_browser = GetBrowser();
704 711
705 if (browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt == VT_ DISPATCH) 712 if (ccom_browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt = = VT_DISPATCH)
706 { 713 {
707 CComQIPtr<IWebBrowser2> pBrowser = pDispParams->rgvarg[1].pdispVal; 714 CComQIPtr<IWebBrowser2> pBrowser = pDispParams->rgvarg[1].pdispVal;
708 if (pBrowser) 715 if (pBrowser)
709 { 716 {
710 CString url; 717 Wrapper::Browser browser( pBrowser );
711 CComBSTR bstrUrl; 718 std::wstring url;
712 if (SUCCEEDED(pBrowser->get_LocationURL(&bstrUrl)) && ::SysStringLen(b strUrl) > 0) 719 if ( browser.Location_URL( url ) && !url.empty() )
713 { 720 {
714 url = bstrUrl; 721 Wrapper::Unescape_URL(url);
715 722 m_tab->OnDocumentComplete(ccom_browser, url, ccom_browser.IsEqualObj ect(pBrowser));
716 CPluginClient::UnescapeUrl(url);
717
718 m_tab->OnDocumentComplete(browser, url, browser.IsEqualObject(pBrows er));
719 } 723 }
720 } 724 }
721 } 725 }
722 } 726 }
723 break; 727 break;
724 728
725 case DISPID_ONQUIT: 729 case DISPID_ONQUIT:
726 case DISPID_QUIT: 730 case DISPID_QUIT:
727 { 731 {
728 Unadvice(); 732 Unadvice();
729 } 733 }
730 break; 734 break;
731 735
732 default: 736 default:
733 { 737 {
734 CString did; 738 std::wostringstream msg;
735 did.Format(L"DispId:%u", dispidMember); 739 msg << L"Navi::Default DispId:";
736 740 msg << static_cast< unsigned long >( dispidMember );
737 DEBUG_NAVI(L"Navi::Default " + did) 741 DEBUG_NAVI( msg.str() )
738 } 742 }
739 743
740 // do nothing 744 // do nothing
741 break; 745 break;
742 } 746 }
743 747
744 return VARIANT_TRUE; 748 return VARIANT_TRUE;
745 } 749 }
746 750
747 bool CPluginClass::InitObject(bool bBHO) 751 bool CPluginClass::InitObject(bool bBHO)
748 { 752 {
749 DEBUG_GENERAL("InitObject"); 753 DEBUG_GENERAL(L"InitObject");
750 CPluginSettings* settings = CPluginSettings::GetInstance(); 754 CPluginSettings* settings = CPluginSettings::GetInstance();
751 755
752 if (!settings->GetPluginEnabled()) 756 if (!settings->GetPluginEnabled())
753 { 757 {
754 s_mimeFilter->Unregister(); 758 s_mimeFilter->Unregister();
755 } 759 }
756 760
757 // Load theme module 761 // Load theme module
758 s_criticalSectionLocal.Lock(); 762 s_criticalSectionLocal.Lock();
759 { 763 {
760 if (!s_hUxtheme) 764 if (!s_hUxtheme)
761 { 765 {
762 s_hUxtheme = ::GetModuleHandle(_T("uxtheme.dll")); 766 s_hUxtheme = ::GetModuleHandleW(L"uxtheme.dll");
763 if (s_hUxtheme) 767 if (s_hUxtheme)
764 { 768 {
765 pfnClose = (CLOSETHEMEDATA)::GetProcAddress(s_hUxtheme, "CloseThemeData" ); 769 pfnClose = (CLOSETHEMEDATA)::GetProcAddress(s_hUxtheme, "CloseThemeData" );
766 if (!pfnClose) 770 if (!pfnClose)
767 { 771 {
768 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET _UXTHEME_CLOSE, "Class::InitObject - GetProcAddress(CloseThemeData)"); 772 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET _UXTHEME_CLOSE, L"Class::InitObject - GetProcAddress(CloseThemeData)");
769 } 773 }
770 774
771 pfnDrawThemeBackground = (DRAWTHEMEBACKGROUND)::GetProcAddress(s_hUxthem e, "DrawThemeBackground"); 775 pfnDrawThemeBackground = (DRAWTHEMEBACKGROUND)::GetProcAddress(s_hUxthem e, "DrawThemeBackground");
772 if (!pfnDrawThemeBackground) 776 if (!pfnDrawThemeBackground)
773 { 777 {
774 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET _UXTHEME_DRAW_BACKGROUND, "Class::InitObject - GetProcAddress(DrawThemeBackgroun d)"); 778 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET _UXTHEME_DRAW_BACKGROUND, L"Class::InitObject - GetProcAddress(DrawThemeBackgrou nd)");
775 } 779 }
776 780
777 pfnOpenThemeData = (OPENTHEMEDATA)::GetProcAddress(s_hUxtheme, "OpenThem eData"); 781 pfnOpenThemeData = (OPENTHEMEDATA)::GetProcAddress(s_hUxtheme, "OpenThem eData");
778 if (!pfnOpenThemeData) 782 if (!pfnOpenThemeData)
779 { 783 {
780 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET _UXTHEME_OPEN, "Class::InitObject - GetProcAddress(pfnOpenThemeData)"); 784 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET _UXTHEME_OPEN, L"Class::InitObject - GetProcAddress(pfnOpenThemeData)");
781 } 785 }
782 } 786 }
783 else 787 else
784 { 788 {
785 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_U XTHEME, "Class::InitObject - GetModuleHandle(uxtheme.dll)"); 789 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_U XTHEME, L"Class::InitObject - GetModuleHandle(uxtheme.dll)");
786 } 790 }
787 } 791 }
788 } 792 }
789 s_criticalSectionLocal.Unlock(); 793 s_criticalSectionLocal.Unlock();
790 794
791 // Register pane class 795 // Register pane class
792 if (!GetAtomPaneClass()) 796 if (!GetAtomPaneClass())
793 { 797 {
794 WNDCLASSEX wcex; 798 WNDCLASSEX wcex;
795 799
(...skipping 11 matching lines...) Expand all
807 wcex.hIconSm = NULL; 811 wcex.hIconSm = NULL;
808 812
809 s_criticalSectionLocal.Lock(); 813 s_criticalSectionLocal.Lock();
810 { 814 {
811 s_atomPaneClass = ::RegisterClassEx(&wcex); 815 s_atomPaneClass = ::RegisterClassEx(&wcex);
812 } 816 }
813 s_criticalSectionLocal.Unlock(); 817 s_criticalSectionLocal.Unlock();
814 818
815 if (!GetAtomPaneClass()) 819 if (!GetAtomPaneClass())
816 { 820 {
817 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTE R_PANE_CLASS, "Class::InitObject - RegisterClassEx"); 821 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTE R_PANE_CLASS, L"Class::InitObject - RegisterClassEx");
818 return false; 822 return false;
819 } 823 }
820 } 824 }
821 825
822 826
823 int ieVersion = CPluginClient::GetInstance()->GetIEVersion(); 827 int ieVersion = CPluginClient::GetInstance()->GetIEVersion();
824 // Create status pane 828 // Create status pane
825 if (bBHO && ieVersion > 6 && !CreateStatusBarPane()) 829 if (bBHO && ieVersion > 6 && !CreateStatusBarPane())
826 { 830 {
827 return false; 831 return false;
(...skipping 23 matching lines...) Expand all
851 { 855 {
852 CriticalSection::Lock lock(m_csStatusBar); 856 CriticalSection::Lock lock(m_csStatusBar);
853 857
854 CPluginClient* client = CPluginClient::GetInstance(); 858 CPluginClient* client = CPluginClient::GetInstance();
855 859
856 TCHAR szClassName[MAX_PATH]; 860 TCHAR szClassName[MAX_PATH];
857 // Get browser window and url 861 // Get browser window and url
858 HWND hBrowserWnd = GetBrowserHWND(); 862 HWND hBrowserWnd = GetBrowserHWND();
859 if (!hBrowserWnd) 863 if (!hBrowserWnd)
860 { 864 {
861 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C lass::CreateStatusBarPane - No status bar") 865 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, L" Class::CreateStatusBarPane - No status bar")
862 return false; 866 return false;
863 } 867 }
864 868
865 // Looking for a TabWindowClass window in IE7 869 // Looking for a TabWindowClass window in IE7
866 // the last one should be parent for statusbar 870 // the last one should be parent for statusbar
867 HWND hWndStatusBar = NULL; 871 HWND hWndStatusBar = NULL;
868 872
869 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); 873 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD);
870 UINT amoundOfNewTabs = 0; 874 UINT amoundOfNewTabs = 0;
871 HWND uniqueNewTab = NULL; 875 HWND uniqueNewTab = NULL;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 { 937 {
934 hWndStatusBar = hWnd; 938 hWndStatusBar = hWnd;
935 break; 939 break;
936 } 940 }
937 941
938 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT); 942 hWnd = ::GetWindow(hWnd, GW_HWNDNEXT);
939 } 943 }
940 944
941 if (!hWndStatusBar) 945 if (!hWndStatusBar)
942 { 946 {
943 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class ::CreateStatusBarPane - No status bar") 947 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, L"Clas s::CreateStatusBarPane - No status bar")
944 return true; 948 return true;
945 } 949 }
946 950
947 // Calculate pane height 951 // Calculate pane height
948 CRect rcStatusBar; 952 CRect rcStatusBar;
949 ::GetClientRect(hWndStatusBar, &rcStatusBar); 953 ::GetClientRect(hWndStatusBar, &rcStatusBar);
950 954
951 if (rcStatusBar.Height() > 0) 955 if (rcStatusBar.Height() > 0)
952 { 956 {
953 #ifdef _DEBUG 957 #ifdef _DEBUG
(...skipping 17 matching lines...) Expand all
971 _T(""), 975 _T(""),
972 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, 976 WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
973 rcStatusBar.Width() - 500,0,m_nPaneWidth,rcStatusBar.Height(), 977 rcStatusBar.Width() - 500,0,m_nPaneWidth,rcStatusBar.Height(),
974 hWndStatusBar, 978 hWndStatusBar,
975 (HMENU)3671, 979 (HMENU)3671,
976 _Module.m_hInst, 980 _Module.m_hInst,
977 NULL); 981 NULL);
978 982
979 if (!hWndNewPane) 983 if (!hWndNewPane)
980 { 984 {
981 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") 985 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_ST ATUSBAR_PANE, L"Class::CreateStatusBarPane - CreateWindowEx")
982 return false; 986 return false;
983 } 987 }
984 988
985 DEBUG_GENERAL("ABP window created"); 989 DEBUG_GENERAL(L"ABP window created");
986 m_hTabWnd = hTabWnd; 990 m_hTabWnd = hTabWnd;
987 m_hStatusBarWnd = hWndStatusBar; 991 m_hStatusBarWnd = hWndStatusBar;
988 m_hPaneWnd = hWndNewPane; 992 m_hPaneWnd = hWndNewPane;
989 993
990 UpdateTheme(); 994 UpdateTheme();
991 995
992 // Subclass status bar 996 // Subclass status bar
993 m_pWndProcStatus = (WNDPROC)SetWindowLongPtr(hWndStatusBar, GWLP_WNDPROC, (LPA RAM)(WNDPROC)NewStatusProc); 997 m_pWndProcStatus = (WNDPROC)SetWindowLongPtr(hWndStatusBar, GWLP_WNDPROC, (LPA RAM)(WNDPROC)NewStatusProc);
994 998
995 // Adjust pane 999 // Adjust pane
(...skipping 12 matching lines...) Expand all
1008 HDC hdc = GetWindowDC(m_hStatusBarWnd); 1012 HDC hdc = GetWindowDC(m_hStatusBarWnd);
1009 SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0); 1013 SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0);
1010 ReleaseDC(m_hStatusBarWnd, hdc); 1014 ReleaseDC(m_hStatusBarWnd, hdc);
1011 1015
1012 return true; 1016 return true;
1013 } 1017 }
1014 1018
1015 void CPluginClass::FirstRunThread() 1019 void CPluginClass::FirstRunThread()
1016 { 1020 {
1017 CoInitialize(NULL); 1021 CoInitialize(NULL);
1018 VARIANT vFlags;
1019 vFlags.vt = VT_I4;
1020 vFlags.intVal = navOpenInNewTab;
1021 1022
1022 CComBSTR navigatePath = CComBSTR(FirstRunPageFileUrl().c_str()); 1023 Wrapper::Browser browser( GetAsyncBrowser() );
1023 1024 HRESULT hr = browser.navigate( FirstRunPageFileUrl() );
1024 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU LL); 1025 if ( FAILED( hr ) )
1025 if (FAILED(hr))
1026 { 1026 {
1027 vFlags.intVal = navOpenInNewWindow; 1027 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME , L"Navigation::Welcome page failed")
1028 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL);
1029 }
1030
1031 if (FAILED(hr))
1032 {
1033 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME , "Navigation::Welcome page failed")
1034 } 1028 }
1035 } 1029 }
1030
1036 void CPluginClass::CloseTheme() 1031 void CPluginClass::CloseTheme()
1037 { 1032 {
1038 if (m_hTheme) 1033 if (m_hTheme)
1039 { 1034 {
1040 if (pfnClose) 1035 if (pfnClose)
1041 { 1036 {
1042 pfnClose(m_hTheme); 1037 pfnClose(m_hTheme);
1043 } 1038 }
1044 1039
1045 m_hTheme = NULL; 1040 m_hTheme = NULL;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, O LECMD prgCmds[], OLECMDTEXT* pCmdText) 1101 STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, O LECMD prgCmds[], OLECMDTEXT* pCmdText)
1107 { 1102 {
1108 if (cCmds == 0) return E_INVALIDARG; 1103 if (cCmds == 0) return E_INVALIDARG;
1109 if (prgCmds == 0) return E_POINTER; 1104 if (prgCmds == 0) return E_POINTER;
1110 1105
1111 prgCmds[0].cmdf = OLECMDF_ENABLED; 1106 prgCmds[0].cmdf = OLECMDF_ENABLED;
1112 1107
1113 return S_OK; 1108 return S_OK;
1114 } 1109 }
1115 1110
1116 HMENU CPluginClass::CreatePluginMenu(const CString& url) 1111 HMENU CPluginClass::CreatePluginMenu(const std::wstring & url)
1117 { 1112 {
1118 DEBUG_GENERAL("CreatePluginMenu"); 1113 DEBUG_GENERAL(L"CreatePluginMenu");
1119 HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance(); 1114 HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance();
1120 1115
1121 HMENU hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1)); 1116 HMENU hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1));
1122 1117
1123 HMENU hMenuTrackPopup = GetSubMenu(hMenu, 0); 1118 HMENU hMenuTrackPopup = GetSubMenu(hMenu, 0);
1124 1119
1125 SetMenuBar(hMenuTrackPopup, url); 1120 SetMenuBar(hMenuTrackPopup, url);
1126 1121
1127 return hMenuTrackPopup; 1122 return hMenuTrackPopup;
1128 } 1123 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 } 1298 }
1304 } 1299 }
1305 s_criticalSectionLocal.Unlock(); 1300 s_criticalSectionLocal.Unlock();
1306 } 1301 }
1307 break; 1302 break;
1308 case ID_MENU_SETTINGS: 1303 case ID_MENU_SETTINGS:
1309 { 1304 {
1310 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); 1305 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser();
1311 if (browser) 1306 if (browser)
1312 { 1307 {
1313 VARIANT vFlags; 1308 Wrapper::Browser b( browser );
1314 vFlags.vt = VT_I4; 1309 HRESULT hr = b.navigate( UserSettingsFileUrl() );
1315 vFlags.intVal = navOpenInNewTab; 1310 if ( FAILED(hr) )
1316
1317 BSTR urlToNavigate = BString(UserSettingsFileUrl());
1318 HRESULT hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL) ;
1319 if (FAILED(hr))
1320 { 1311 {
1321 vFlags.intVal = navOpenInNewWindow; 1312 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_S ETTINGS, L"Navigation::Failed")
1322
1323 hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL);
1324 if (FAILED(hr))
1325 {
1326 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed")
1327 }
1328 } 1313 }
1329 } 1314 }
1330 break; 1315 break;
1331 } 1316 }
1332 case ID_MENU_DISABLE_ON_SITE: 1317 case ID_MENU_DISABLE_ON_SITE:
1333 { 1318 {
1334 CPluginSettings* settings = CPluginSettings::GetInstance(); 1319 CPluginSettings* settings = CPluginSettings::GetInstance();
1335 CString urlString = GetTab()->GetDocumentUrl(); 1320 std::wstring urlString = GetTab()->GetDocumentUrl();
1336 if (client->IsWhitelistedUrl(std::wstring(urlString))) 1321 if (client->IsWhitelistedUrl(urlString))
1337 { 1322 {
1338 settings->RemoveWhiteListedDomain(client->GetHostFromUrl(urlString.GetSt ring()).c_str()); 1323 settings->RemoveWhiteListedDomain( client->GetHostFromUrl( urlString ).c _str() );
1339 } 1324 }
1340 else 1325 else
1341 { 1326 {
1342 settings->AddWhiteListedDomain(client->GetHostFromUrl(urlString.GetStrin g()).c_str()); 1327 settings->AddWhiteListedDomain( client->GetHostFromUrl( urlString).c_str ());
1343 } 1328 }
1344 GetBrowser()->Refresh(); 1329 GetBrowser()->Refresh();
1345 } 1330 }
1346 default: 1331 default:
1347 break; 1332 break;
1348 } 1333 }
1349 1334
1350 // Invalidate and redraw the control 1335 // Invalidate and redraw the control
1351 UpdateStatusBar(); 1336 UpdateStatusBar();
1352 } 1337 }
1353 1338
1354 1339
1355 bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url) 1340 bool CPluginClass::SetMenuBar(HMENU hMenu, const std::wstring & url)
1356 { 1341 {
1357 DEBUG_GENERAL("SetMenuBar"); 1342 DEBUG_GENERAL(L"SetMenuBar");
1358 1343
1359 std::wstring ctext; 1344 std::wstring ctext;
1360 1345
1361 s_criticalSectionLocal.Lock(); 1346 s_criticalSectionLocal.Lock();
1362 { 1347 {
1363 #ifdef SUPPORT_WHITELIST 1348 #ifdef SUPPORT_WHITELIST
1364 s_menuDomains.clear(); 1349 s_menuDomains.clear();
1365 #endif 1350 #endif
1366 } 1351 }
1367 s_criticalSectionLocal.Unlock(); 1352 s_criticalSectionLocal.Unlock();
(...skipping 12 matching lines...) Expand all
1380 miiSep.fType = MFT_SEPARATOR; 1365 miiSep.fType = MFT_SEPARATOR;
1381 1366
1382 CPluginClient* client = CPluginClient::GetInstance(); 1367 CPluginClient* client = CPluginClient::GetInstance();
1383 1368
1384 CPluginSettings* settings = CPluginSettings::GetInstance(); 1369 CPluginSettings* settings = CPluginSettings::GetInstance();
1385 1370
1386 #ifdef SUPPORT_WHITELIST 1371 #ifdef SUPPORT_WHITELIST
1387 { 1372 {
1388 ctext = dictionary->Lookup("menu", "menu-disable-on-site"); 1373 ctext = dictionary->Lookup("menu", "menu-disable-on-site");
1389 // Is domain in white list? 1374 // Is domain in white list?
1390 ReplaceString(ctext, L"?1?", client->GetHostFromUrl(url.GetString())); 1375 ReplaceString(ctext, L"?1?", client->GetHostFromUrl(url));
1391 if (client->IsWhitelistedUrl(std::wstring(GetTab()->GetDocumentUrl()))) 1376 if (client->IsWhitelistedUrl(std::wstring(GetTab()->GetDocumentUrl())))
1392 { 1377 {
1393 fmii.fState = MFS_CHECKED | MFS_ENABLED; 1378 fmii.fState = MFS_CHECKED | MFS_ENABLED;
1394 } 1379 }
1395 else 1380 else
1396 { 1381 {
1397 fmii.fState = MFS_UNCHECKED | MFS_ENABLED; 1382 fmii.fState = MFS_UNCHECKED | MFS_ENABLED;
1398 } 1383 }
1399 fmii.fMask = MIIM_STRING | MIIM_STATE; 1384 fmii.fMask = MIIM_STRING | MIIM_STATE;
1400 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); 1385 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 } 1586 }
1602 1587
1603 LRESULT result = CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wPara m, lParam); 1588 LRESULT result = CallWindowProc(pClass->m_pWndProcStatus, hWnd, message, wPara m, lParam);
1604 1589
1605 1590
1606 return result; 1591 return result;
1607 1592
1608 } 1593 }
1609 1594
1610 1595
1611 HICON CPluginClass::GetStatusBarIcon(const CString& url) 1596 HICON CPluginClass::GetStatusBarIcon(const std::wstring & url)
1612 { 1597 {
1613 // use the disable icon as defualt, if the client doesn't exists 1598 // use the disable icon as defualt, if the client doesn't exists
1614 HICON hIcon = GetIcon(ICON_PLUGIN_DEACTIVATED); 1599 HICON hIcon = GetIcon(ICON_PLUGIN_DEACTIVATED);
1615 1600
1616 CPluginTab* tab = GetTab(::GetCurrentThreadId()); 1601 CPluginTab* tab = GetTab(::GetCurrentThreadId());
1617 if (tab) 1602 if (tab)
1618 { 1603 {
1619 CPluginClient* client = CPluginClient::GetInstance(); 1604 CPluginClient* client = CPluginClient::GetInstance();
1620 1605
1621 #ifdef PRODUCT_ADBLOCKPLUS 1606 #ifdef PRODUCT_ADBLOCKPLUS
1622 if (!CPluginSettings::GetInstance()->IsPluginEnabled()) 1607 if (!CPluginSettings::GetInstance()->IsPluginEnabled())
1623 { 1608 {
1624 } 1609 }
1625 #ifdef SUPPORT_WHITELIST 1610 #ifdef SUPPORT_WHITELIST
1626 else if (client->IsWhitelistedUrl(std::wstring(url))) 1611 else if (client->IsWhitelistedUrl( url ))
1627 { 1612 {
1628 hIcon = GetIcon(ICON_PLUGIN_DISABLED); 1613 hIcon = GetIcon(ICON_PLUGIN_DISABLED);
1629 } 1614 }
1630 #endif // SUPPORT_WHITELIST 1615 #endif // SUPPORT_WHITELIST
1631 else 1616 else
1632 { 1617 {
1633 CPluginSettings* settings = CPluginSettings::GetInstance(); 1618 CPluginSettings* settings = CPluginSettings::GetInstance();
1634 hIcon = GetIcon(ICON_PLUGIN_ENABLED); 1619 hIcon = GetIcon(ICON_PLUGIN_ENABLED);
1635 } 1620 }
1636 1621
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 { 1693 {
1709 ::SetPixel(hDC, i, j, clr); 1694 ::SetPixel(hDC, i, j, clr);
1710 } 1695 }
1711 } 1696 }
1712 } 1697 }
1713 } 1698 }
1714 1699
1715 // Draw icon 1700 // Draw icon
1716 if (CPluginClient::GetInstance()) 1701 if (CPluginClient::GetInstance())
1717 { 1702 {
1718 HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl()); 1703 HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl().c_str( ));
1719 1704
1720 int offx = (rcClient.Height() - 16)/2 + nDrawEdge; 1705 int offx = (rcClient.Height() - 16)/2 + nDrawEdge;
1721 if (hIcon) 1706 if (hIcon)
1722 { 1707 {
1723 ::DrawIconEx(hDC, offx, (rcClient.Height() - 16)/2 + 2, hIcon, 16, 16, NULL, NULL, DI_NORMAL); 1708 ::DrawIconEx(hDC, offx, (rcClient.Height() - 16)/2 + 2, hIcon, 16, 16, NULL, NULL, DI_NORMAL);
1724 offx += 22; 1709 offx += 22;
1725 } 1710 }
1726 #ifdef _DEBUG 1711 #ifdef _DEBUG
1727 // Display version 1712 // Display version
1728 HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT, 0, 0); 1713 HFONT hFont = (HFONT)::SendMessage(pClass->m_hStatusBarWnd, WM_GETFONT, 0, 0);
(...skipping 10 matching lines...) Expand all
1739 1724
1740 // Done! 1725 // Done!
1741 EndPaint(hWnd, &ps); 1726 EndPaint(hWnd, &ps);
1742 1727
1743 return 0; 1728 return 0;
1744 } 1729 }
1745 1730
1746 case WM_LBUTTONUP: 1731 case WM_LBUTTONUP:
1747 case WM_RBUTTONUP: 1732 case WM_RBUTTONUP:
1748 { 1733 {
1749 CString strURL = pClass->GetBrowserUrl(); 1734 std::wstring url = pClass->GetBrowserUrl();
1750 if (strURL != pClass->GetTab()->GetDocumentUrl()) 1735 if (url != pClass->GetTab()->GetDocumentUrl())
1751 { 1736 {
1752 pClass->GetTab()->SetDocumentUrl(strURL); 1737 pClass->GetTab()->SetDocumentUrl( url );
1753 } 1738 }
1754 1739
1755 // Create menu 1740 // Create menu
1756 HMENU hMenu = pClass->CreatePluginMenu(strURL); 1741 HMENU hMenu = pClass->CreatePluginMenu( url );
1757 if (!hMenu) 1742 if (!hMenu)
1758 { 1743 {
1759 return 0; 1744 return 0;
1760 } 1745 }
1761 1746
1762 // Display menu 1747 // Display menu
1763 POINT pt; 1748 POINT pt;
1764 ::GetCursorPos(&pt); 1749 ::GetCursorPos(&pt);
1765 1750
1766 RECT rc; 1751 RECT rc;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 } 1825 }
1841 break; 1826 break;
1842 } 1827 }
1843 1828
1844 return DefWindowProc(hWnd, message, wParam, lParam); 1829 return DefWindowProc(hWnd, message, wParam, lParam);
1845 } 1830 }
1846 1831
1847 1832
1848 void CPluginClass::UpdateStatusBar() 1833 void CPluginClass::UpdateStatusBar()
1849 { 1834 {
1850 DEBUG_GENERAL("*** Updating statusbar") 1835 DEBUG_GENERAL(L"*** Updating statusbar")
1851 if (m_hPaneWnd == NULL) 1836 if (m_hPaneWnd == NULL)
1852 { 1837 {
1853 CreateStatusBarPane(); 1838 CreateStatusBarPane();
1854 } 1839 }
1855 if ((m_hPaneWnd != NULL) && !::InvalidateRect(m_hPaneWnd, NULL, FALSE)) 1840 if ((m_hPaneWnd != NULL) && !::InvalidateRect(m_hPaneWnd, NULL, FALSE))
1856 { 1841 {
1857 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALID ATE_STATUSBAR, "Class::Invalidate statusbar"); 1842 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALID ATE_STATUSBAR, L"Class::Invalidate statusbar");
1858 } 1843 }
1859 } 1844 }
1860 1845
1861 1846
1862 void CPluginClass::Unadvice() 1847 void CPluginClass::Unadvice()
1863 { 1848 {
1864 s_criticalSectionLocal.Lock(); 1849 s_criticalSectionLocal.Lock();
1865 { 1850 {
1866 if (m_isAdviced) 1851 if (m_isAdviced)
1867 { 1852 {
1868 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); 1853 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint();
1869 if (pPoint) 1854 if (pPoint)
1870 { 1855 {
1871 HRESULT hr = pPoint->Unadvise(m_nConnectionID); 1856 HRESULT hr = pPoint->Unadvise(m_nConnectionID);
1872 if (FAILED(hr)) 1857 if (FAILED(hr))
1873 { 1858 {
1874 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_UNADV ICE, "Class::Unadvice - Unadvise"); 1859 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_UNADV ICE, L"Class::Unadvice - Unadvise");
1875 } 1860 }
1876 } 1861 }
1877 1862
1878 m_isAdviced = false; 1863 m_isAdviced = false;
1879 } 1864 }
1880 } 1865 }
1881 s_criticalSectionLocal.Unlock(); 1866 s_criticalSectionLocal.Unlock();
1882 } 1867 }
1883 1868
1884 HICON CPluginClass::GetIcon(int type) 1869 HICON CPluginClass::GetIcon(int type)
1885 { 1870 {
1886 HICON icon = NULL; 1871 HICON icon = NULL;
1887 1872
1888 s_criticalSectionLocal.Lock(); 1873 s_criticalSectionLocal.Lock();
1889 { 1874 {
1890 if (!s_hIcons[type]) 1875 if (!s_hIcons[type])
1891 { 1876 {
1892 s_hIcons[type] = ::LoadIcon(_Module.m_hInst, MAKEINTRESOURCE(s_hIconTypes[ type])); 1877 s_hIcons[type] = ::LoadIcon(_Module.m_hInst, MAKEINTRESOURCE(s_hIconTypes[ type]));
1893 if (!s_hIcons[type]) 1878 if (!s_hIcons[type])
1894 { 1879 {
1895 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_ ICON, "Class::GetIcon - LoadIcon") 1880 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_ ICON, L"Class::GetIcon - LoadIcon")
1896 } 1881 }
1897 } 1882 }
1898 1883
1899 icon = s_hIcons[type]; 1884 icon = s_hIcons[type];
1900 } 1885 }
1901 s_criticalSectionLocal.Unlock(); 1886 s_criticalSectionLocal.Unlock();
1902 1887
1903 return icon; 1888 return icon;
1904 } 1889 }
1905 1890
1906 ATOM CPluginClass::GetAtomPaneClass() 1891 ATOM CPluginClass::GetAtomPaneClass()
1907 { 1892 {
1908 return s_atomPaneClass; 1893 return s_atomPaneClass;
1909 } 1894 }
1910 1895
1911 HWND CPluginClass::GetTabHWND() const 1896 HWND CPluginClass::GetTabHWND() const
1912 { 1897 {
1913 1898
1914 TCHAR szClassName[MAX_PATH]; 1899 TCHAR szClassName[MAX_PATH];
1915 // Get browser window and url 1900 // Get browser window and url
1916 HWND hBrowserWnd = GetBrowserHWND(); 1901 HWND hBrowserWnd = GetBrowserHWND();
1917 if (!hBrowserWnd) 1902 if (!hBrowserWnd)
1918 { 1903 {
1919 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "C lass::GetTabWindow - No tab window") 1904 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, L" Class::GetTabWindow - No tab window")
1920 s_criticalSectionWindow.Unlock(); 1905 s_criticalSectionWindow.Unlock();
1921 1906
1922 return false; 1907 return false;
1923 } 1908 }
1924 1909
1925 // Looking for a TabWindowClass window in IE7 1910 // Looking for a TabWindowClass window in IE7
1926 1911
1927 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD); 1912 HWND hTabWnd = ::GetWindow(hBrowserWnd, GW_CHILD);
1928 while (hTabWnd) 1913 while (hTabWnd)
1929 { 1914 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 } 1956 }
1972 } 1957 }
1973 } 1958 }
1974 1959
1975 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1960 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1976 } 1961 }
1977 1962
1978 return hTabWnd; 1963 return hTabWnd;
1979 1964
1980 } 1965 }
OLDNEW

Powered by Google App Engine
This is Rietveld