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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #include "PluginStdAfx.h" | 18 #include "PluginStdAfx.h" |
19 | 19 |
20 #include "PluginClient.h" | 20 #include "PluginClient.h" |
21 #include "PluginSettings.h" | 21 #include "PluginSettings.h" |
22 #include "AdblockPlusDomTraverser.h" | 22 #include "AdblockPlusDomTraverser.h" |
23 #include "PluginClass.h" | 23 #include "PluginClass.h" |
24 #include "PluginTabBase.h" | 24 #include "PluginTabBase.h" |
25 #include "PluginUtil.h" | 25 #include "PluginUtil.h" |
26 #include "../shared/IE_version.h" | 26 #include "../shared/IE_version.h" |
27 #include <dispex.h> | 27 #include <dispex.h> |
28 #include <Mshtmhst.h> | 28 #include <Mshtmhst.h> |
29 | 29 |
30 int CPluginTabBase::s_dictionaryVersion = 0; | |
31 int CPluginTabBase::s_settingsVersion = 1; | |
32 int CPluginTabBase::s_filterVersion = 0; | |
33 int CPluginTabBase::s_whitelistVersion = 0; | |
34 | |
35 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) | 30 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) |
36 : m_plugin(plugin) | 31 : m_plugin(plugin) |
37 , m_isActivated(false) | 32 , m_isActivated(false) |
38 , m_continueThreadRunning(true) | 33 , m_continueThreadRunning(true) |
39 { | 34 { |
40 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); | 35 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); |
41 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL); | 36 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL); |
42 | 37 |
43 CPluginClient* client = CPluginClient::GetInstance(); | 38 CPluginClient* client = CPluginClient::GetInstance(); |
44 if (AdblockPlus::IE::InstalledMajorVersion() < 10) | 39 if (AdblockPlus::IE::InstalledMajorVersion() < 10) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 auto url = GetDocumentUrl(); | 117 auto url = GetDocumentUrl(); |
123 | 118 |
124 std::wstring log = L"InjectABP. Current URL: "; | 119 std::wstring log = L"InjectABP. Current URL: "; |
125 log += url; | 120 log += url; |
126 log += L", settings URL: "; | 121 log += L", settings URL: "; |
127 log += UserSettingsFileUrl(); | 122 log += UserSettingsFileUrl(); |
128 DEBUG_GENERAL(log); | 123 DEBUG_GENERAL(log); |
129 | 124 |
130 CString urlLegacy = ToCString(url); | 125 CString urlLegacy = ToCString(url); |
131 if (!(0 == urlLegacy.CompareNoCase(CString(UserSettingsFileUrl().c_str())) || | 126 if (!(0 == urlLegacy.CompareNoCase(CString(UserSettingsFileUrl().c_str())) || |
132 0 == urlLegacy.CompareNoCase(CString(FirstRunPageFileUrl().c_str())))) | 127 0 == urlLegacy.CompareNoCase(CString(FirstRunPageFileUrl().c_str())))) |
Oleksandr
2015/02/27 07:50:15
I really don't think there are many other options
Eric
2015/02/27 14:26:56
I changed only the code relevant to the DEBUG_GENE
| |
133 { | 128 { |
134 DEBUG_GENERAL(L"Not injecting"); | 129 DEBUG_GENERAL(L"Not injecting"); |
135 return; | 130 return; |
136 } | 131 } |
137 DEBUG_GENERAL(L"Going to inject"); | 132 DEBUG_GENERAL(L"Going to inject"); |
138 CComPtr<IDispatch> pDocDispatch; | 133 CComPtr<IDispatch> pDocDispatch; |
139 browser->get_Document(&pDocDispatch); | 134 browser->get_Document(&pDocDispatch); |
140 CComQIPtr<IHTMLDocument2> pDoc2 = pDocDispatch; | 135 CComQIPtr<IHTMLDocument2> pDoc2 = pDocDispatch; |
141 if (!pDoc2) | 136 if (!pDoc2) |
142 { | 137 { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 while (this->m_continueThreadRunning) | 336 while (this->m_continueThreadRunning) |
342 { | 337 { |
343 #ifdef ENABLE_DEBUG_THREAD | 338 #ifdef ENABLE_DEBUG_THREAD |
344 CStringA sTabLoopIteration; | 339 CStringA sTabLoopIteration; |
345 sTabLoopIteration.Format("%u", tabLoopIteration); | 340 sTabLoopIteration.Format("%u", tabLoopIteration); |
346 | 341 |
347 DEBUG_THREAD("-------------------------------------------------------------- ------------------") | 342 DEBUG_THREAD("-------------------------------------------------------------- ------------------") |
348 DEBUG_THREAD("Loop iteration " + sTabLoopIteration); | 343 DEBUG_THREAD("Loop iteration " + sTabLoopIteration); |
349 DEBUG_THREAD("-------------------------------------------------------------- ------------------") | 344 DEBUG_THREAD("-------------------------------------------------------------- ------------------") |
350 #endif | 345 #endif |
351 if (this->m_isActivated) | 346 this->m_isActivated = false; |
352 { | |
353 bool isChanged = false; | |
354 | |
355 if (isChanged) | |
356 { | |
357 this->m_plugin->UpdateStatusBar(); | |
358 } | |
359 | |
360 this->m_isActivated = false; | |
361 } | |
362 | 347 |
363 // -------------------------------------------------------------------- | 348 // -------------------------------------------------------------------- |
364 // End loop | 349 // End loop |
365 // -------------------------------------------------------------------- | 350 // -------------------------------------------------------------------- |
366 | 351 |
367 // Sleep loop | 352 // Sleep loop |
368 while (this->m_continueThreadRunning && !this->m_isActivated && (++loopCou nt % (TIMER_THREAD_SLEEP_TAB_LOOP / 50)) != 0) | 353 while (this->m_continueThreadRunning && !this->m_isActivated && (++loopCou nt % (TIMER_THREAD_SLEEP_TAB_LOOP / 50)) != 0) |
369 { | 354 { |
370 // Post async plugin error | 355 // Post async plugin error |
371 CPluginError pluginError; | 356 CPluginError pluginError; |
372 if (CPluginClient::PopFirstPluginError(pluginError)) | 357 if (LogQueue::PopFirstPluginError(pluginError)) |
373 { | 358 { |
374 CPluginClient::LogPluginError(pluginError.GetErrorCode(), pluginError. GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), tr ue, pluginError.GetProcessId(), pluginError.GetThreadId()); | 359 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p luginError.GetProcessId(), pluginError.GetThreadId()); |
375 } | 360 } |
376 | 361 |
377 // Non-hanging sleep | 362 // Non-hanging sleep |
378 Sleep(50); | 363 Sleep(50); |
379 } | 364 } |
380 | 365 |
381 tabLoopIteration++; | 366 tabLoopIteration++; |
382 } | 367 } |
383 } | 368 } |
LEFT | RIGHT |