| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/download_protection_service.h" | 5 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // SAFE even if the server says it's dangerous to download this file. | 458 // SAFE even if the server says it's dangerous to download this file. |
| 459 // Note: if service_ is NULL we already cancelled the request and | 459 // Note: if service_ is NULL we already cancelled the request and |
| 460 // returned SAFE. | 460 // returned SAFE. |
| 461 reason = REASON_DOWNLOAD_NOT_SUPPORTED; | 461 reason = REASON_DOWNLOAD_NOT_SUPPORTED; |
| 462 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS) { | 462 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS) { |
| 463 reason = REASON_DOWNLOAD_DANGEROUS; | 463 reason = REASON_DOWNLOAD_DANGEROUS; |
| 464 result = DANGEROUS; | 464 result = DANGEROUS; |
| 465 } else if (response.verdict() == ClientDownloadResponse::UNCOMMON) { | 465 } else if (response.verdict() == ClientDownloadResponse::UNCOMMON) { |
| 466 reason = REASON_DOWNLOAD_UNCOMMON; | 466 reason = REASON_DOWNLOAD_UNCOMMON; |
| 467 result = UNCOMMON; | 467 result = UNCOMMON; |
| 468 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS_HOST) { |
| 469 reason = REASON_DOWNLOAD_DANGEROUS_HOST; |
| 470 result = DANGEROUS_HOST; |
| 468 } else { | 471 } else { |
| 469 LOG(DFATAL) << "Unknown download response verdict: " | 472 LOG(DFATAL) << "Unknown download response verdict: " |
| 470 << response.verdict(); | 473 << response.verdict(); |
| 471 reason = REASON_INVALID_RESPONSE_VERDICT; | 474 reason = REASON_INVALID_RESPONSE_VERDICT; |
| 472 } | 475 } |
| 473 } | 476 } |
| 474 // We don't need the fetcher anymore. | 477 // We don't need the fetcher anymore. |
| 475 fetcher_.reset(); | 478 fetcher_.reset(); |
| 476 RecordImprovedProtectionStats(reason); | 479 RecordImprovedProtectionStats(reason); |
| 477 UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestDuration", | 480 UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestDuration", |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 std::string url = kDownloadRequestUrl; | 986 std::string url = kDownloadRequestUrl; |
| 984 std::string api_key = google_apis::GetAPIKey(); | 987 std::string api_key = google_apis::GetAPIKey(); |
| 985 if (!api_key.empty()) { | 988 if (!api_key.empty()) { |
| 986 base::StringAppendF(&url, "?key=%s", | 989 base::StringAppendF(&url, "?key=%s", |
| 987 net::EscapeQueryParamValue(api_key, true).c_str()); | 990 net::EscapeQueryParamValue(api_key, true).c_str()); |
| 988 } | 991 } |
| 989 return url; | 992 return url; |
| 990 } | 993 } |
| 991 | 994 |
| 992 } // namespace safe_browsing | 995 } // namespace safe_browsing |
| OLD | NEW |