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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 reason = REASON_DOWNLOAD_NOT_SUPPORTED; | 410 reason = REASON_DOWNLOAD_NOT_SUPPORTED; |
411 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS) { | 411 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS) { |
412 reason = REASON_DOWNLOAD_DANGEROUS; | 412 reason = REASON_DOWNLOAD_DANGEROUS; |
413 result = DANGEROUS; | 413 result = DANGEROUS; |
414 } else if (response.verdict() == ClientDownloadResponse::UNCOMMON) { | 414 } else if (response.verdict() == ClientDownloadResponse::UNCOMMON) { |
415 reason = REASON_DOWNLOAD_UNCOMMON; | 415 reason = REASON_DOWNLOAD_UNCOMMON; |
416 result = UNCOMMON; | 416 result = UNCOMMON; |
417 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS_HOST) { | 417 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS_HOST) { |
418 reason = REASON_DOWNLOAD_DANGEROUS_HOST; | 418 reason = REASON_DOWNLOAD_DANGEROUS_HOST; |
419 result = DANGEROUS_HOST; | 419 result = DANGEROUS_HOST; |
| 420 } else if ( |
| 421 response.verdict() == ClientDownloadResponse::POTENTIALLY_UNWANTED) { |
| 422 reason = REASON_DOWNLOAD_POTENTIALLY_UNWANTED; |
| 423 result = POTENTIALLY_UNWANTED; |
420 } else { | 424 } else { |
421 LOG(DFATAL) << "Unknown download response verdict: " | 425 LOG(DFATAL) << "Unknown download response verdict: " |
422 << response.verdict(); | 426 << response.verdict(); |
423 reason = REASON_INVALID_RESPONSE_VERDICT; | 427 reason = REASON_INVALID_RESPONSE_VERDICT; |
424 } | 428 } |
425 DownloadFeedbackService::MaybeStorePingsForDownload( | 429 DownloadFeedbackService::MaybeStorePingsForDownload( |
426 result, item_, client_download_request_data_, data); | 430 result, item_, client_download_request_data_, data); |
427 } | 431 } |
428 // We don't need the fetcher anymore. | 432 // We don't need the fetcher anymore. |
429 fetcher_.reset(); | 433 fetcher_.reset(); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 std::string url = kDownloadRequestUrl; | 956 std::string url = kDownloadRequestUrl; |
953 std::string api_key = google_apis::GetAPIKey(); | 957 std::string api_key = google_apis::GetAPIKey(); |
954 if (!api_key.empty()) { | 958 if (!api_key.empty()) { |
955 base::StringAppendF(&url, "?key=%s", | 959 base::StringAppendF(&url, "?key=%s", |
956 net::EscapeQueryParamValue(api_key, true).c_str()); | 960 net::EscapeQueryParamValue(api_key, true).c_str()); |
957 } | 961 } |
958 return url; | 962 return url; |
959 } | 963 } |
960 | 964 |
961 } // namespace safe_browsing | 965 } // namespace safe_browsing |
OLD | NEW |