| LEFT | RIGHT |
| 1 #include <AdblockPlus.h> | 1 #include <AdblockPlus.h> |
| 2 #include <functional> | 2 #include <functional> |
| 3 #include <vector> | 3 #include <vector> |
| 4 #include <thread> | 4 #include <thread> |
| 5 #include <Windows.h> | 5 #include <Windows.h> |
| 6 | 6 |
| 7 #include "../shared/AutoHandle.h" | 7 #include "../shared/AutoHandle.h" |
| 8 #include "../shared/Communication.h" | 8 #include "../shared/Communication.h" |
| 9 #include "../shared/Dictionary.h" | 9 #include "../shared/Dictionary.h" |
| 10 #include "../shared/Utils.h" | 10 #include "../shared/Utils.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 request >> procedure; | 86 request >> procedure; |
| 87 switch (procedure) | 87 switch (procedure) |
| 88 { | 88 { |
| 89 case Communication::PROC_MATCHES: | 89 case Communication::PROC_MATCHES: |
| 90 { | 90 { |
| 91 std::string url; | 91 std::string url; |
| 92 std::string type; | 92 std::string type; |
| 93 std::string documentUrl; | 93 std::string documentUrl; |
| 94 request >> url >> type >> documentUrl; | 94 request >> url >> type >> documentUrl; |
| 95 referrerMapping.Add(url, documentUrl); | 95 referrerMapping.Add(url, documentUrl); |
| 96 AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, referre
rMapping.BuildReferrerChain(url)); | 96 AdblockPlus::FilterPtr filter = filterEngine->Matches(url, type, referre
rMapping.BuildReferrerChain(documentUrl)); |
| 97 response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EX
CEPTION); | 97 response << (filter && filter->GetType() != AdblockPlus::Filter::TYPE_EX
CEPTION); |
| 98 break; | 98 break; |
| 99 } | 99 } |
| 100 case Communication::PROC_GET_ELEMHIDE_SELECTORS: | 100 case Communication::PROC_GET_ELEMHIDE_SELECTORS: |
| 101 { | 101 { |
| 102 std::string domain; | 102 std::string domain; |
| 103 request >> domain; | 103 request >> domain; |
| 104 WriteStrings(response, filterEngine->GetElementHidingSelectors(domain)); | 104 WriteStrings(response, filterEngine->GetElementHidingSelectors(domain)); |
| 105 break; | 105 break; |
| 106 } | 106 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 break; | 190 break; |
| 191 } | 191 } |
| 192 case Communication::PROC_IS_WHITELISTED_URL: | 192 case Communication::PROC_IS_WHITELISTED_URL: |
| 193 { | 193 { |
| 194 std::string url; | 194 std::string url; |
| 195 request >> url; | 195 request >> url; |
| 196 AdblockPlus::FilterPtr match = filterEngine->Matches(url, "DOCUMENT", ur
l); | 196 AdblockPlus::FilterPtr match = filterEngine->Matches(url, "DOCUMENT", ur
l); |
| 197 response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCE
PTION); | 197 response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCE
PTION); |
| 198 break; | 198 break; |
| 199 } | 199 } |
| 200 case Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL: |
| 201 { |
| 202 std::string url; |
| 203 request >> url; |
| 204 AdblockPlus::FilterPtr match = filterEngine->Matches(url, "ELEMHIDE", ur
l); |
| 205 response << (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCE
PTION); |
| 206 break; |
| 207 } |
| 200 case Communication::PROC_ADD_FILTER: | 208 case Communication::PROC_ADD_FILTER: |
| 201 { | 209 { |
| 202 std::string text; | 210 std::string text; |
| 203 request >> text; | 211 request >> text; |
| 204 | 212 |
| 205 filterEngine->GetFilter(text)->AddToList(); | 213 filterEngine->GetFilter(text)->AddToList(); |
| 206 break; | 214 break; |
| 207 } | 215 } |
| 208 case Communication::PROC_REMOVE_FILTER: | 216 case Communication::PROC_REMOVE_FILTER: |
| 209 { | 217 { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 CriticalSection::Lock lock(firstRunLock); | 306 CriticalSection::Lock lock(firstRunLock); |
| 299 if (!firstRunActionExecuted && filterEngine->IsFirstRun()) | 307 if (!firstRunActionExecuted && filterEngine->IsFirstRun()) |
| 300 { | 308 { |
| 301 response << true; | 309 response << true; |
| 302 firstRunActionExecuted = true; | 310 firstRunActionExecuted = true; |
| 303 } | 311 } |
| 304 else | 312 else |
| 305 { | 313 { |
| 306 response << false; | 314 response << false; |
| 307 } | 315 } |
| 316 break; |
| 317 } |
| 318 case Communication::PROC_COMPARE_VERSIONS: |
| 319 { |
| 320 std::string v1, v2; |
| 321 request >> v1 >> v2; |
| 322 |
| 323 response << filterEngine->CompareVersions(v1, v2); |
| 308 break; | 324 break; |
| 309 } | 325 } |
| 310 case Communication::PROC_GET_DOCUMENTATION_LINK: | 326 case Communication::PROC_GET_DOCUMENTATION_LINK: |
| 311 { | 327 { |
| 312 response << ToUtf16String(filterEngine->GetPref("documentation_link")->A
sString()); | 328 response << ToUtf16String(filterEngine->GetPref("documentation_link")->A
sString()); |
| 313 break; | 329 break; |
| 314 } | 330 } |
| 315 case Communication::PROC_TOGGLE_PLUGIN_ENABLED: | 331 case Communication::PROC_TOGGLE_PLUGIN_ENABLED: |
| 316 { | 332 { |
| 317 filterEngine->SetPref("enabled", filterEngine->GetJsEngine()->NewValue(!
filterEngine->GetPref("enabled")->AsBool())); | 333 filterEngine->SetPref("enabled", filterEngine->GetJsEngine()->NewValue(!
filterEngine->GetPref("enabled")->AsBool())); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 std::auto_ptr<AdblockPlus::FilterEngine> CreateFilterEngine(const std::wstring&
locale) | 416 std::auto_ptr<AdblockPlus::FilterEngine> CreateFilterEngine(const std::wstring&
locale) |
| 401 { | 417 { |
| 402 AdblockPlus::AppInfo appInfo; | 418 AdblockPlus::AppInfo appInfo; |
| 403 appInfo.version = ToUtf8String(IEPLUGIN_VERSION); | 419 appInfo.version = ToUtf8String(IEPLUGIN_VERSION); |
| 404 appInfo.name = "adblockplusie"; | 420 appInfo.name = "adblockplusie"; |
| 405 #ifdef _WIN64 | 421 #ifdef _WIN64 |
| 406 appInfo.application = "msie64"; | 422 appInfo.application = "msie64"; |
| 407 #else | 423 #else |
| 408 appInfo.application = "msie32"; | 424 appInfo.application = "msie32"; |
| 409 #endif | 425 #endif |
| 410 appInfo.applicationVersion = ToUtf8String( AdblockPlus::IE::installed_version_
string() ); | 426 appInfo.applicationVersion = ToUtf8String(AdblockPlus::IE::InstalledVersionStr
ing()); |
| 411 appInfo.locale = ToUtf8String(locale); | 427 appInfo.locale = ToUtf8String(locale); |
| 412 #ifdef ADBLOCK_PLUS_TEST_MODE | 428 #ifdef ADBLOCK_PLUS_TEST_MODE |
| 413 appInfo.developmentBuild = true; | 429 appInfo.developmentBuild = true; |
| 414 #else | 430 #else |
| 415 appInfo.developmentBuild = false; | 431 appInfo.developmentBuild = false; |
| 416 #endif | 432 #endif |
| 417 | 433 |
| 418 AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::New(appInfo); | 434 AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::New(appInfo); |
| 419 jsEngine->SetEventCallback("updateAvailable", &OnUpdateAvailable); | 435 jsEngine->SetEventCallback("updateAvailable", &OnUpdateAvailable); |
| 420 | 436 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 485 } |
| 470 catch (const std::runtime_error& e) | 486 catch (const std::runtime_error& e) |
| 471 { | 487 { |
| 472 DebugException(e); | 488 DebugException(e); |
| 473 return 1; | 489 return 1; |
| 474 } | 490 } |
| 475 } | 491 } |
| 476 | 492 |
| 477 return 0; | 493 return 0; |
| 478 } | 494 } |
| LEFT | RIGHT |