| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); | 41 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); |
| 42 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); | 42 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); |
| 43 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); | 43 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); |
| 44 | 44 |
| 45 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; | 45 HICON CPluginClass::s_hIcons[ICON_MAX] = { NULL, NULL, NULL }; |
| 46 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED }; | 46 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED }; |
| 47 uint32_t iconHeight = 32; | 47 uint32_t iconHeight = 32; |
| 48 uint32_t iconWidth = 32; | 48 uint32_t iconWidth = 32; |
| 49 | 49 |
| 50 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL; | |
| 51 | |
| 50 CLOSETHEMEDATA pfnClose = NULL; | 52 CLOSETHEMEDATA pfnClose = NULL; |
| 51 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; | 53 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; |
| 52 OPENTHEMEDATA pfnOpenThemeData = NULL; | 54 OPENTHEMEDATA pfnOpenThemeData = NULL; |
| 53 | 55 |
| 54 ATOM CPluginClass::s_atomPaneClass = NULL; | 56 ATOM CPluginClass::s_atomPaneClass = NULL; |
| 55 HINSTANCE CPluginClass::s_hUxtheme = NULL; | 57 HINSTANCE CPluginClass::s_hUxtheme = NULL; |
| 56 std::set<CPluginClass*> CPluginClass::s_instances; | 58 std::set<CPluginClass*> CPluginClass::s_instances; |
| 57 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; | 59 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; |
| 58 | 60 |
| 59 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal; | 61 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 { | 194 { |
| 193 url = m_tab->GetDocumentUrl(); | 195 url = m_tab->GetDocumentUrl(); |
| 194 } | 196 } |
| 195 return url; | 197 return url; |
| 196 } | 198 } |
| 197 | 199 |
| 198 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) | 200 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) |
| 199 { | 201 { |
| 200 if (thisPtr == NULL) | 202 if (thisPtr == NULL) |
| 201 return 0; | 203 return 0; |
| 202 if (!((CPluginClass*)thisPtr)->InitObject(true)) | 204 if (!((CPluginClass*)thisPtr)->InitObject()) |
| 203 { | 205 { |
| 204 ((CPluginClass*)thisPtr)->Unadvise(); | 206 ((CPluginClass*)thisPtr)->Unadvise(); |
| 205 } | 207 } |
| 206 | 208 |
| 207 return 0; | 209 return 0; |
| 208 } | 210 } |
| 209 | 211 |
| 210 // This gets called when a new browser window is created (which also triggers th e | 212 /* |
| 211 // creation of this object). The pointer passed in should be to a IWebBrowser2 | 213 * IE calls this when it creates a new browser window or tab, immediately after it also |
| 212 // interface that represents the browser for the window. | 214 * creates the object. The argument 'unknownSite' in is the OLE "site" of the ob ject, |
| 213 // it is also called when a tab is closed, this unknownSite will be null | 215 * which is an IWebBrowser2 interface associated with the window/tab. |
| 214 // so we should handle that it is called this way several times during a session | 216 * |
| 217 * IE also ordinarily calls this again when its window/tab is closed, in which c ase | |
| 218 * 'unknownSite' will be null. Extraordinarily, this is sometimes _not_ called w hen IE | |
| 219 * is shutting down. Thus 'SetSite(nullptr)' has some similarities with a destru ctor, | |
| 220 * but it is not a proper substitute for one. | |
| 221 */ | |
| 215 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite) | 222 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite) |
| 216 { | 223 { |
| 217 CPluginSettings* settings = CPluginSettings::GetInstance(); | 224 try |
| 218 | 225 { |
| 219 MULTIPLE_VERSIONS_CHECK(); | 226 if (unknownSite) |
| 220 | 227 { |
| 221 if (unknownSite) | 228 |
| 222 { | 229 DEBUG_GENERAL(L"========================================================== ======================\nNEW TAB UI\n============================================ ====================================") |
| 223 | 230 |
| 224 DEBUG_GENERAL(L"============================================================ ====================\nNEW TAB UI\n============================================== ==================================") | 231 HRESULT hr = ::CoInitialize(NULL); |
| 225 | 232 if (FAILED(hr)) |
| 226 HRESULT hr = ::CoInitialize(NULL); | 233 { |
| 227 if (FAILED(hr)) | 234 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, "Class::SetSite - CoInitialize"); |
| 228 { | 235 } |
| 229 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, " Class::SetSite - CoInitialize"); | 236 |
| 230 } | 237 s_criticalSectionBrowser.Lock(); |
| 231 | 238 { |
| 232 s_criticalSectionBrowser.Lock(); | 239 m_webBrowser2 = unknownSite; |
| 233 { | 240 } |
| 234 m_webBrowser2 = unknownSite; | 241 s_criticalSectionBrowser.Unlock(); |
| 235 } | 242 |
| 236 s_criticalSectionBrowser.Unlock(); | 243 //register the mimefilter |
| 237 | 244 //and only mimefilter |
| 238 //register the mimefilter | 245 //on some few computers the mimefilter does not get properly registered wh en it is done on another thread |
| 239 //and only mimefilter | 246 |
| 240 //on some few computers the mimefilter does not get properly registered when it is done on another thread | 247 s_criticalSectionLocal.Lock(); |
| 241 | 248 { |
| 242 s_criticalSectionLocal.Lock(); | 249 // Always register on startup, then check if we need to unregister in a separate thread |
| 243 { | 250 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
| 244 // Always register on startup, then check if we need to unregister in a se parate thread | 251 s_asyncWebBrowser2 = unknownSite; |
| 245 CPluginClientFactory::GetMimeFilterClientInstance(); | 252 s_instances.insert(this); |
| 246 s_asyncWebBrowser2 = unknownSite; | 253 } |
| 247 s_instances.insert(this); | 254 s_criticalSectionLocal.Unlock(); |
| 248 } | 255 |
| 249 s_criticalSectionLocal.Unlock(); | 256 try |
| 250 | 257 { |
| 251 try | 258 auto webBrowser = GetBrowser(); |
| 252 { | 259 if (webBrowser) |
| 253 // Check if loaded as BHO | 260 { |
| 254 auto webBrowser = GetBrowser(); | 261 DEBUG_GENERAL("Loaded as BHO"); |
| 255 if (webBrowser) | 262 HRESULT hr = DispEventAdvise(webBrowser); |
| 256 { | 263 if (SUCCEEDED(hr)) |
| 257 DEBUG_GENERAL("Loaded as BHO"); | |
| 258 HRESULT hr = DispEventAdvise(webBrowser); | |
| 259 if (SUCCEEDED(hr)) | |
| 260 { | |
| 261 m_isAdvised = true; | |
| 262 try | |
| 263 { | 264 { |
| 264 std::thread startInitObjectThread(StartInitObject, this); | 265 m_isAdvised = true; |
| 265 startInitObjectThread.detach(); // TODO: but actually we should wait for the thread in the dtr. | 266 try |
| 267 { | |
| 268 std::thread startInitObjectThread(StartInitObject, this); | |
| 269 startInitObjectThread.detach(); // TODO: but actually we should wa it for the thread in the dtr. | |
| 270 } | |
| 271 catch (const std::system_error& ex) | |
| 272 { | |
| 273 DEBUG_SYSTEM_EXCEPTION(ex, PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_ THREAD_CREATE_PROCESS, | |
| 274 "Class::Thread - Failed to create StartInitObject thread"); | |
| 275 } | |
| 266 } | 276 } |
| 267 catch (const std::system_error& ex) | 277 else |
| 268 { | 278 { |
| 269 DEBUG_SYSTEM_EXCEPTION(ex, PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_TH READ_CREATE_PROCESS, | 279 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADV ICE, "Class::SetSite - Advise"); |
| 270 "Class::Thread - Failed to create StartInitObject thread"); | |
| 271 } | 280 } |
| 272 } | 281 } |
| 273 else | 282 } |
| 274 { | 283 catch (const std::runtime_error& ex) |
| 275 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADVIC E, "Class::SetSite - Advise"); | 284 { |
| 276 } | 285 DEBUG_EXCEPTION(ex); |
| 277 } | 286 Unadvise(); |
| 278 else // Check if loaded as toolbar handler | 287 } |
| 279 { | 288 } |
| 280 DEBUG_GENERAL("Loaded as toolbar handler"); | 289 else |
| 281 CComPtr<IServiceProvider> pServiceProvider; | 290 { |
| 282 | |
| 283 HRESULT hr = unknownSite->QueryInterface(&pServiceProvider); | |
| 284 if (SUCCEEDED(hr)) | |
| 285 { | |
| 286 if (pServiceProvider) | |
| 287 { | |
| 288 s_criticalSectionBrowser.Lock(); | |
| 289 { | |
| 290 HRESULT hr = pServiceProvider->QueryService(IID_IWebBrowserApp, &m _webBrowser2); | |
| 291 if (SUCCEEDED(hr)) | |
| 292 { | |
| 293 if (m_webBrowser2) | |
| 294 { | |
| 295 InitObject(false); | |
| 296 } | |
| 297 } | |
| 298 else | |
| 299 { | |
| 300 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE _QUERY_BROWSER, "Class::SetSite - QueryService (IID_IWebBrowserApp)"); | |
| 301 } | |
| 302 } | |
| 303 s_criticalSectionBrowser.Unlock(); | |
| 304 } | |
| 305 } | |
| 306 else | |
| 307 { | |
| 308 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY _SERVICE_PROVIDER, "Class::SetSite - QueryInterface (service provider)"); | |
| 309 } | |
| 310 } | |
| 311 } | |
| 312 catch (const std::runtime_error& ex) | |
| 313 { | |
| 314 DEBUG_EXCEPTION(ex); | |
| 315 Unadvise(); | 291 Unadvise(); |
| 316 } | 292 |
| 317 } | 293 // Destroy window |
| 318 else | 294 if (m_pWndProcStatus) |
| 319 { | 295 { |
| 320 Unadvise(); | 296 ::SetWindowLongPtr(m_hStatusBarWnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)m_pWn dProcStatus); |
| 321 | 297 |
| 322 // Destroy window | 298 m_pWndProcStatus = NULL; |
| 323 if (m_pWndProcStatus) | 299 } |
| 324 { | 300 |
| 325 ::SetWindowLongPtr(m_hStatusBarWnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)m_pWndP rocStatus); | 301 if (m_hPaneWnd) |
| 326 | 302 { |
| 327 m_pWndProcStatus = NULL; | 303 DestroyWindow(m_hPaneWnd); |
| 328 } | 304 m_hPaneWnd = NULL; |
| 329 | 305 } |
| 330 if (m_hPaneWnd) | 306 |
| 331 { | 307 m_hTabWnd = NULL; |
| 332 DestroyWindow(m_hPaneWnd); | 308 m_hStatusBarWnd = NULL; |
| 333 m_hPaneWnd = NULL; | 309 |
| 334 } | 310 // Remove instance from the list, shutdown threads |
| 335 | 311 HANDLE hMainThread = NULL; |
| 336 m_hTabWnd = NULL; | 312 HANDLE hTabThread = NULL; |
| 337 m_hStatusBarWnd = NULL; | 313 |
| 338 | 314 s_criticalSectionLocal.Lock(); |
| 339 // Remove instance from the list, shutdown threads | 315 { |
| 340 HANDLE hMainThread = NULL; | 316 s_instances.erase(this); |
| 341 HANDLE hTabThread = NULL; | 317 |
| 342 | 318 std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::Ge tCurrentThreadId()); |
| 343 s_criticalSectionLocal.Lock(); | 319 if (it != s_threadInstances.end()) |
| 344 { | 320 { |
| 345 s_instances.erase(this); | 321 s_threadInstances.erase(it); |
| 346 | 322 } |
| 347 std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetC urrentThreadId()); | 323 if (s_instances.empty()) |
| 348 if (it != s_threadInstances.end()) | 324 { |
| 349 { | 325 // TODO: Explicitly releasing a resource when a container becomes empt y looks like a job better suited for shared_ptr |
| 350 s_threadInstances.erase(it); | 326 CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
| 351 } | 327 } |
| 352 if (s_instances.empty()) | 328 } |
| 353 { | 329 s_criticalSectionLocal.Unlock(); |
| 354 // TODO: Explicitly releasing a resource when a container becomes empty looks like a job better suited for shared_ptr | 330 |
| 355 CPluginClientFactory::ReleaseMimeFilterClientInstance(); | 331 // Release browser interface |
| 356 } | 332 s_criticalSectionBrowser.Lock(); |
| 357 } | 333 { |
| 358 s_criticalSectionLocal.Unlock(); | 334 m_webBrowser2.Release(); |
| 359 | 335 } |
| 360 // Release browser interface | 336 s_criticalSectionBrowser.Unlock(); |
| 361 s_criticalSectionBrowser.Lock(); | 337 |
| 362 { | 338 DEBUG_GENERAL("=========================================================== =====================\nNEW TAB UI - END\n======================================= =========================================") |
| 363 m_webBrowser2.Release(); | 339 |
| 364 } | 340 ::CoUninitialize(); |
| 365 s_criticalSectionBrowser.Unlock(); | 341 } |
| 366 | 342 |
| 367 DEBUG_GENERAL("============================================================= ===================\nNEW TAB UI - END\n========================================= =======================================") | 343 IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); |
| 368 | 344 } |
| 369 ::CoUninitialize(); | 345 catch (...) |
| 370 } | 346 { |
| 371 | 347 } |
| 372 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); | 348 return S_OK; |
| 373 } | 349 } |
| 374 | 350 |
| 375 bool CPluginClass::IsStatusBarEnabled() | 351 bool CPluginClass::IsStatusBarEnabled() |
| 376 { | 352 { |
| 377 DEBUG_GENERAL("IsStatusBarEnabled start"); | 353 DEBUG_GENERAL("IsStatusBarEnabled start"); |
| 378 HKEY pHkey; | 354 HKEY pHkey; |
| 379 HKEY pHkeySub; | 355 HKEY pHkeySub; |
| 380 RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey); | 356 RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey); |
| 381 DWORD truth = 1; | 357 DWORD truth = 1; |
| 382 DWORD truthSize = sizeof(truth); | 358 DWORD truthSize = sizeof(truth); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 && flags == (OLECMDIDF_WINDOWSTATE_USERVISIBLE | OLECMDIDF_WINDOWSTATE_ENA BLED); | 563 && flags == (OLECMDIDF_WINDOWSTATE_USERVISIBLE | OLECMDIDF_WINDOWSTATE_ENA BLED); |
| 588 if (newtabshown) | 564 if (newtabshown) |
| 589 { | 565 { |
| 590 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find( GetCurrentThreadId()); | 566 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find( GetCurrentThreadId()); |
| 591 if (it == s_threadInstances.end()) | 567 if (it == s_threadInstances.end()) |
| 592 { | 568 { |
| 593 s_threadInstances[::GetCurrentThreadId()] = this; | 569 s_threadInstances[::GetCurrentThreadId()] = this; |
| 594 if (!m_isInitializedOk) | 570 if (!m_isInitializedOk) |
| 595 { | 571 { |
| 596 m_isInitializedOk = true; | 572 m_isInitializedOk = true; |
| 597 InitObject(true); | 573 InitObject(); |
| 598 UpdateStatusBar(); | 574 UpdateStatusBar(); |
| 599 } | 575 } |
| 600 } | 576 } |
| 601 } | 577 } |
| 602 notificationMessage.Hide(); | 578 notificationMessage.Hide(); |
| 603 DEBUG_GENERAL(L"WindowStateChanged (check tab changed) end"); | 579 DEBUG_GENERAL(L"WindowStateChanged (check tab changed) end"); |
| 604 } | 580 } |
| 605 catch (...) | 581 catch (...) |
| 606 { | 582 { |
| 607 } | 583 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 { | 616 { |
| 641 try | 617 try |
| 642 { | 618 { |
| 643 Unadvise(); | 619 Unadvise(); |
| 644 } | 620 } |
| 645 catch (...) | 621 catch (...) |
| 646 { | 622 { |
| 647 } | 623 } |
| 648 } | 624 } |
| 649 | 625 |
| 650 bool CPluginClass::InitObject(bool bBHO) | 626 bool CPluginClass::InitObject() |
| 651 { | 627 { |
| 652 DEBUG_GENERAL("InitObject"); | 628 DEBUG_GENERAL("InitObject"); |
| 653 CPluginSettings* settings = CPluginSettings::GetInstance(); | 629 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 654 | 630 |
| 655 if (!settings->GetPluginEnabled()) | 631 if (!settings->GetPluginEnabled()) |
| 656 { | 632 { |
| 657 CPluginClientFactory::ReleaseMimeFilterClientInstance(); | 633 s_mimeFilter->Unregister(); |
|
Oleksandr
2015/03/27 08:02:29
This fixes the issue. Just calling Unregister() he
sergei
2015/04/01 18:49:32
No, it does not mean that our APP handlers remain
| |
| 658 } | 634 } |
| 659 | 635 |
| 660 // Load theme module | 636 // Load theme module |
| 661 s_criticalSectionLocal.Lock(); | 637 s_criticalSectionLocal.Lock(); |
| 662 { | 638 { |
| 663 if (!s_hUxtheme) | 639 if (!s_hUxtheme) |
| 664 { | 640 { |
| 665 s_hUxtheme = ::GetModuleHandle(L"uxtheme.dll"); | 641 s_hUxtheme = ::GetModuleHandle(L"uxtheme.dll"); |
| 666 if (s_hUxtheme) | 642 if (s_hUxtheme) |
| 667 { | 643 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 717 | 693 |
| 718 if (!GetAtomPaneClass()) | 694 if (!GetAtomPaneClass()) |
| 719 { | 695 { |
| 720 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTE R_PANE_CLASS, "Class::InitObject - RegisterClassEx"); | 696 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTE R_PANE_CLASS, "Class::InitObject - RegisterClassEx"); |
| 721 return false; | 697 return false; |
| 722 } | 698 } |
| 723 } | 699 } |
| 724 | 700 |
| 725 int ieVersion = AdblockPlus::IE::InstalledMajorVersion(); | 701 int ieVersion = AdblockPlus::IE::InstalledMajorVersion(); |
| 726 // Create status pane | 702 // Create status pane |
| 727 if (bBHO && ieVersion > 6 && !CreateStatusBarPane()) | 703 if (ieVersion > 6 && !CreateStatusBarPane()) |
| 728 { | 704 { |
| 729 return false; | 705 return false; |
| 730 } | 706 } |
| 731 | 707 |
| 732 s_criticalSectionLocal.Lock(); | 708 s_criticalSectionLocal.Lock(); |
| 733 if (CPluginClient::GetInstance()->GetPref(L"currentVersion", L"0.0").find(L"si mpleadblock") != std::wstring::npos) | 709 if (CPluginClient::GetInstance()->GetPref(L"currentVersion", L"0.0").find(L"si mpleadblock") != std::wstring::npos) |
| 734 { | 710 { |
| 735 CPluginClient::GetInstance()->SetPref(L"isFromSimpleAdblock", true); | 711 CPluginClient::GetInstance()->SetPref(L"isFromSimpleAdblock", true); |
| 736 CPluginClient::GetInstance()->SetPref(L"currentVersion", std::wstring(IEPLUG IN_VERSION)); | 712 CPluginClient::GetInstance()->SetPref(L"currentVersion", std::wstring(IEPLUG IN_VERSION)); |
| 737 } | 713 } |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1106 { | 1082 { |
| 1107 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1083 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 1108 | 1084 |
| 1109 settings->TogglePluginEnabled(); | 1085 settings->TogglePluginEnabled(); |
| 1110 | 1086 |
| 1111 // Enable / disable mime filter | 1087 // Enable / disable mime filter |
| 1112 s_criticalSectionLocal.Lock(); | 1088 s_criticalSectionLocal.Lock(); |
| 1113 { | 1089 { |
| 1114 if (settings->GetPluginEnabled()) | 1090 if (settings->GetPluginEnabled()) |
| 1115 { | 1091 { |
| 1116 CPluginClientFactory::GetMimeFilterClientInstance(); | 1092 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
| 1117 } | 1093 } |
| 1118 else | 1094 else |
| 1119 { | 1095 { |
| 1096 s_mimeFilter = NULL; | |
| 1097 | |
| 1120 CPluginClientFactory::ReleaseMimeFilterClientInstance(); | 1098 CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
| 1121 } | 1099 } |
| 1122 } | 1100 } |
| 1123 s_criticalSectionLocal.Unlock(); | 1101 s_criticalSectionLocal.Unlock(); |
| 1124 } | 1102 } |
| 1125 break; | 1103 break; |
| 1126 case ID_MENU_SETTINGS: | 1104 case ID_MENU_SETTINGS: |
| 1127 { | 1105 { |
| 1128 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); | 1106 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); |
| 1129 if (browser) | 1107 if (browser) |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1145 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed") | 1123 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION _SETTINGS, "Navigation::Failed") |
| 1146 } | 1124 } |
| 1147 } | 1125 } |
| 1148 } | 1126 } |
| 1149 break; | 1127 break; |
| 1150 } | 1128 } |
| 1151 case ID_MENU_DISABLE_ON_SITE: | 1129 case ID_MENU_DISABLE_ON_SITE: |
| 1152 { | 1130 { |
| 1153 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1131 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 1154 std::wstring urlString = GetTab()->GetDocumentUrl(); | 1132 std::wstring urlString = GetTab()->GetDocumentUrl(); |
| 1155 if (client->IsWhitelistedUrl(urlString)) | 1133 std::string filterText = client->GetWhitelistingFilter(urlString); |
| 1156 { | 1134 if (!filterText.empty()) |
| 1157 settings->RemoveWhiteListedDomain(ToCString(client->GetHostFromUrl(urlSt ring))); | 1135 { |
| 1136 client->RemoveFilter(filterText); | |
| 1158 } | 1137 } |
| 1159 else | 1138 else |
| 1160 { | 1139 { |
| 1161 settings->AddWhiteListedDomain(ToCString(client->GetHostFromUrl(urlStrin g))); | 1140 settings->AddWhiteListedDomain(ToCString(client->GetHostFromUrl(urlStrin g))); |
| 1162 } | 1141 } |
| 1163 GetBrowser()->Refresh(); | 1142 GetBrowser()->Refresh(); |
| 1164 } | 1143 } |
| 1165 default: | 1144 default: |
| 1166 break; | 1145 break; |
| 1167 } | 1146 } |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1757 s_criticalSectionLocal.Unlock(); | 1736 s_criticalSectionLocal.Unlock(); |
| 1758 | 1737 |
| 1759 } | 1738 } |
| 1760 } | 1739 } |
| 1761 } | 1740 } |
| 1762 | 1741 |
| 1763 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1742 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
| 1764 } | 1743 } |
| 1765 return hTabWnd; | 1744 return hTabWnd; |
| 1766 } | 1745 } |
| LEFT | RIGHT |