OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |