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

Delta Between Two Patch Sets: src/plugin/PluginClass.cpp

Issue 5032147387678720: NoIssue - Refactor HTTP and HTTPS namespaces registration
Left Patch Set: Rename CPluginMimeFilterClient to CPluginAppNamespaceClient Created April 13, 2015, 3:24 a.m.
Right Patch Set: Fix the renaming patchset Created April 24, 2015, 11:57 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 //register the mimefilter 242 //register the mimefilter
243 //and only mimefilter 243 //and only mimefilter
244 //on some few computers the mimefilter does not get properly registered wh en it is done on another thread 244 //on some few computers the mimefilter does not get properly registered wh en it is done on another thread
245 245
246 s_criticalSectionLocal.Lock(); 246 s_criticalSectionLocal.Lock();
247 { 247 {
248 // Always register on startup, then check if we need to unregister in a separate thread 248 // Always register on startup, then check if we need to unregister in a separate thread
249 if (!s_mimeFilter) 249 if (!s_mimeFilter)
250 { 250 {
251 s_mimeFilter.reset(new CPluginAppNamespaceClient()); 251 s_mimeFilter.reset(new CPluginAppNamespaceClient());
Oleksandr 2015/04/13 03:34:51 It doesn't look like CPluginAppNammespaceClient()
Eric 2015/05/16 21:00:02 It can throw. This constructor calls 'CMetaFactory
Eric 2015/05/16 21:00:48 's_mimeFilter' should probably also be renamed in
252 } 252 }
253 s_asyncWebBrowser2 = unknownSite; 253 s_asyncWebBrowser2 = unknownSite;
254 s_instances.insert(this); 254 s_instances.insert(this);
255 } 255 }
256 s_criticalSectionLocal.Unlock(); 256 s_criticalSectionLocal.Unlock();
257 257
258 try 258 try
259 { 259 {
260 auto webBrowser = GetBrowser(); 260 auto webBrowser = GetBrowser();
261 if (webBrowser) 261 if (webBrowser)
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 { 475 {
476 return; 476 return;
477 } 477 }
478 if (!urlVariant || urlVariant->vt != VT_BSTR) 478 if (!urlVariant || urlVariant->vt != VT_BSTR)
479 { 479 {
480 return; 480 return;
481 } 481 }
482 std::wstring url(urlVariant->bstrVal, SysStringLen(urlVariant->bstrVal)); 482 std::wstring url(urlVariant->bstrVal, SysStringLen(urlVariant->bstrVal));
483 UnescapeUrl(url); 483 UnescapeUrl(url);
484 484
485 //Register a mime filter if it's not registered yet
486 if (s_mimeFilter == nullptr)
487 {
488 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance();
489 }
485 // If webbrowser2 is equal to top level browser (as set in SetSite), we are 490 // If webbrowser2 is equal to top level browser (as set in SetSite), we are
486 // navigating new page 491 // navigating new page
487 CPluginClient* client = CPluginClient::GetInstance(); 492 CPluginClient* client = CPluginClient::GetInstance();
488 if (url.find(L"javascript") == 0) 493 if (url.find(L"javascript") == 0)
489 { 494 {
490 } 495 }
491 else if (GetBrowser().IsEqualObject(webBrowser)) 496 else if (GetBrowser().IsEqualObject(webBrowser))
492 { 497 {
493 m_tab->OnNavigate(url); 498 m_tab->OnNavigate(url);
494 DEBUG_GENERAL( 499 DEBUG_GENERAL(
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 } 701 }
697 702
698 int ieVersion = AdblockPlus::IE::InstalledMajorVersion(); 703 int ieVersion = AdblockPlus::IE::InstalledMajorVersion();
699 // Create status pane 704 // Create status pane
700 if (ieVersion > 6 && !CreateStatusBarPane()) 705 if (ieVersion > 6 && !CreateStatusBarPane())
701 { 706 {
702 return false; 707 return false;
703 } 708 }
704 709
705 s_criticalSectionLocal.Lock(); 710 s_criticalSectionLocal.Lock();
706 if (CPluginClient::GetInstance()->GetPref(L"currentVersion", L"0.0").find(L"si mpleadblock") != std::wstring::npos)
707 {
708 CPluginClient::GetInstance()->SetPref(L"isFromSimpleAdblock", true);
709 CPluginClient::GetInstance()->SetPref(L"currentVersion", std::wstring(IEPLUG IN_VERSION));
710 }
711 int versionCompRes = CPluginClient::GetInstance()->CompareVersions(CPluginClie nt::GetInstance()->GetPref(L"currentVersion", L"0.0"), L"1.2"); 711 int versionCompRes = CPluginClient::GetInstance()->CompareVersions(CPluginClie nt::GetInstance()->GetPref(L"currentVersion", L"0.0"), L"1.2");
712 712
713 bool isFirstRun = CPluginClient::GetInstance()->IsFirstRun(); 713 bool isFirstRun = CPluginClient::GetInstance()->IsFirstRun();
714 CPluginClient::GetInstance()->SetPref(L"currentVersion", std::wstring(IEPLUGIN _VERSION)); 714 CPluginClient::GetInstance()->SetPref(L"currentVersion", std::wstring(IEPLUGIN _VERSION));
715 // This is the first time ABP was installed 715 // This is the first time ABP was installed
716 // Or ABP was updated from the version that did not support Acceptable Ads (<1 .2) 716 // Or ABP was updated from the version that did not support Acceptable Ads (<1 .2)
717 if (isFirstRun || versionCompRes < 0) 717 if (isFirstRun || versionCompRes < 0)
718 { 718 {
719 if (!isFirstRun) 719 if (!isFirstRun)
720 { 720 {
721 if (!CPluginClient::GetInstance()->GetPref(std::wstring(L"isFromSimpleAdbl ock"), false)) 721 CPluginClient::GetInstance()->SetPref(L"displayUpdatePage", true);
722 {
723 CPluginClient::GetInstance()->SetPref(L"displayUpdatePage", true);
724 }
725 } 722 }
726 723
727 // IE6 can't be accessed from another thread, execute in current thread 724 // IE6 can't be accessed from another thread, execute in current thread
728 if (ieVersion < 7) 725 if (ieVersion < 7)
729 { 726 {
730 FirstRunThread(); 727 FirstRunThread();
731 } 728 }
732 else 729 else
733 { 730 {
734 CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThr ead, NULL, NULL, NULL); 731 CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThr ead, NULL, NULL, NULL);
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 s_criticalSectionLocal.Unlock(); 1728 s_criticalSectionLocal.Unlock();
1732 1729
1733 } 1730 }
1734 } 1731 }
1735 } 1732 }
1736 1733
1737 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1734 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1738 } 1735 }
1739 return hTabWnd; 1736 return hTabWnd;
1740 } 1737 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld