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

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

Issue 5994126579335168: Noissue - Remove a dead inheritance and some dead code (Closed)
Left Patch Set: Created Feb. 18, 2015, 7:06 p.m.
Right Patch Set: Remove comment Created Feb. 27, 2015, 4:47 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
« no previous file with change/comment | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/Config.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return new Communication::Pipe(Communication::pipeName, Communication: :Pipe::MODE_CONNECT); 118 return new Communication::Pipe(Communication::pipeName, Communication: :Pipe::MODE_CONNECT);
119 } 119 }
120 catch (Communication::PipeConnectionError e) 120 catch (Communication::PipeConnectionError e)
121 { 121 {
122 } 122 }
123 } 123 }
124 throw std::runtime_error("Unable to open Adblock Plus Engine pipe"); 124 throw std::runtime_error("Unable to open Adblock Plus Engine pipe");
125 } 125 }
126 } 126 }
127 127
128 std::vector<std::wstring> ReadStrings(Communication::InputBuffer& message)
129 {
130 int32_t count;
131 message >> count;
132
133 std::vector<std::wstring> result;
134 for (int32_t i = 0; i < count; i++)
135 {
136 std::string str;
137 message >> str;
138 result.push_back(ToUtf16String(str));
139 }
140 return result;
141 }
142
143 std::vector<SubscriptionDescription> ReadSubscriptions(Communication::InputBuf fer& message) 128 std::vector<SubscriptionDescription> ReadSubscriptions(Communication::InputBuf fer& message)
144 { 129 {
145 int32_t count; 130 int32_t count;
146 message >> count; 131 message >> count;
147 132
148 std::vector<SubscriptionDescription> result; 133 std::vector<SubscriptionDescription> result;
149 for (int32_t i = 0; i < count; i++) 134 for (int32_t i = 0; i < count; i++)
150 { 135 {
151 SubscriptionDescription description; 136 SubscriptionDescription description;
152 std::string url; 137 std::string url;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 305 }
321 306
322 std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const st d::wstring& domain) 307 std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const st d::wstring& domain)
323 { 308 {
324 Communication::OutputBuffer request; 309 Communication::OutputBuffer request;
325 request << Communication::PROC_GET_ELEMHIDE_SELECTORS << ToUtf8String(domain); 310 request << Communication::PROC_GET_ELEMHIDE_SELECTORS << ToUtf8String(domain);
326 311
327 Communication::InputBuffer response; 312 Communication::InputBuffer response;
328 if (!CallEngine(request, response)) 313 if (!CallEngine(request, response))
329 return std::vector<std::wstring>(); 314 return std::vector<std::wstring>();
330 return ReadStrings(response); 315
316 std::vector<std::string> selectors;
317 response >> selectors;
318 return ToUtf16Strings(selectors);
331 } 319 }
332 320
333 std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscript ions() 321 std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscript ions()
334 { 322 {
335 Communication::InputBuffer response; 323 Communication::InputBuffer response;
336 if (!CallEngine(Communication::PROC_AVAILABLE_SUBSCRIPTIONS, response)) 324 if (!CallEngine(Communication::PROC_AVAILABLE_SUBSCRIPTIONS, response))
337 return std::vector<SubscriptionDescription>(); 325 return std::vector<SubscriptionDescription>();
338 return ReadSubscriptions(response); 326 return ReadSubscriptions(response);
339 } 327 }
340 328
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 void CAdblockPlusClient::UpdateAllSubscriptions() 374 void CAdblockPlusClient::UpdateAllSubscriptions()
387 { 375 {
388 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS); 376 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS);
389 } 377 }
390 378
391 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains() 379 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains()
392 { 380 {
393 Communication::InputBuffer response; 381 Communication::InputBuffer response;
394 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response)) 382 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response))
395 return std::vector<std::wstring>(); 383 return std::vector<std::wstring>();
396 return ReadStrings(response); 384
385 std::vector<std::string> domains;
386 response >> domains;
387 return ToUtf16Strings(domains);
397 } 388 }
398 389
399 bool CAdblockPlusClient::IsFirstRun() 390 bool CAdblockPlusClient::IsFirstRun()
400 { 391 {
401 DEBUG_GENERAL("IsFirstRun"); 392 DEBUG_GENERAL("IsFirstRun");
402 Communication::InputBuffer response; 393 Communication::InputBuffer response;
403 if (!CallEngine(Communication::PROC_IS_FIRST_RUN_ACTION_NEEDED, response)) ret urn false; 394 if (!CallEngine(Communication::PROC_IS_FIRST_RUN_ACTION_NEEDED, response)) ret urn false;
404 bool res; 395 bool res;
405 response >> res; 396 response >> res;
406 return res; 397 return res;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 DEBUG_GENERAL("CompareVersions"); 558 DEBUG_GENERAL("CompareVersions");
568 Communication::OutputBuffer request; 559 Communication::OutputBuffer request;
569 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2); 560 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2);
570 Communication::InputBuffer response; 561 Communication::InputBuffer response;
571 if (!CallEngine(request, response)) 562 if (!CallEngine(request, response))
572 return 0; 563 return 0;
573 int result; 564 int result;
574 response >> result; 565 response >> result;
575 return result; 566 return result;
576 } 567 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld