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

Delta Between Two Patch Sets: src/engine/Main.cpp

Issue 5171515343503360: Issue #41 - Bring method of determining IE version up to date (Closed)
Left Patch Set: Created July 30, 2014, 1 p.m.
Right Patch Set: Final (?) 2 Created Jan. 5, 2015, 1:02 p.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 #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
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
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
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld