Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_service.cc

Issue 6014003: Intergration of the client-side phishing detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove comment Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 5 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util_proxy.h" 9 #include "base/file_util_proxy.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 ClientPhishingResponse response; 438 ClientPhishingResponse response;
439 scoped_ptr<ClientReportInfo> info(client_phishing_reports_[source]); 439 scoped_ptr<ClientReportInfo> info(client_phishing_reports_[source]);
440 if (status.is_success() && RC_REQUEST_OK == response_code && 440 if (status.is_success() && RC_REQUEST_OK == response_code &&
441 response.ParseFromString(data)) { 441 response.ParseFromString(data)) {
442 // Cache response, possibly flushing an old one. 442 // Cache response, possibly flushing an old one.
443 cache_[info->phishing_url] = 443 cache_[info->phishing_url] =
444 make_linked_ptr(new CacheState(response.phishy(), base::Time::Now())); 444 make_linked_ptr(new CacheState(response.phishy(), base::Time::Now()));
445 info->callback->Run(info->phishing_url, response.phishy()); 445 info->callback->Run(info->phishing_url, response.phishy());
446 } else { 446 } else {
447 DLOG(ERROR) << "Unable to get the server verdict for URL: " 447 DLOG(ERROR) << "Unable to get the server verdict for URL: "
448 << info->phishing_url; 448 << info->phishing_url << " status: " << status.status() << " "
449 << "response_code:" << response_code;
449 info->callback->Run(info->phishing_url, false); 450 info->callback->Run(info->phishing_url, false);
450 } 451 }
451 client_phishing_reports_.erase(source); 452 client_phishing_reports_.erase(source);
452 delete source; 453 delete source;
453 } 454 }
454 455
455 bool ClientSideDetectionService::GetCachedResult(const GURL& url, 456 bool ClientSideDetectionService::GetCachedResult(const GURL& url,
456 bool* is_phishing) { 457 bool* is_phishing) {
457 UpdateCache(); 458 UpdateCache();
458 459
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 while (!phishing_report_times_.empty() && 503 while (!phishing_report_times_.empty() &&
503 phishing_report_times_.front() < cutoff) { 504 phishing_report_times_.front() < cutoff) {
504 phishing_report_times_.pop(); 505 phishing_report_times_.pop();
505 } 506 }
506 507
507 // Return the number of elements that are above the cutoff. 508 // Return the number of elements that are above the cutoff.
508 return phishing_report_times_.size(); 509 return phishing_report_times_.size();
509 } 510 }
510 511
511 } // namespace safe_browsing 512 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698