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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 net::HTTP_OK == source->GetResponseCode()) { | 440 net::HTTP_OK == source->GetResponseCode()) { |
441 ClientDownloadResponse response; | 441 ClientDownloadResponse response; |
442 std::string data; | 442 std::string data; |
443 bool got_data = source->GetResponseAsString(&data); | 443 bool got_data = source->GetResponseAsString(&data); |
444 DCHECK(got_data); | 444 DCHECK(got_data); |
445 if (!response.ParseFromString(data)) { | 445 if (!response.ParseFromString(data)) { |
446 reason = REASON_INVALID_RESPONSE_PROTO; | 446 reason = REASON_INVALID_RESPONSE_PROTO; |
447 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS) { | 447 } else if (response.verdict() == ClientDownloadResponse::DANGEROUS) { |
448 reason = REASON_DOWNLOAD_DANGEROUS; | 448 reason = REASON_DOWNLOAD_DANGEROUS; |
449 result = DANGEROUS; | 449 result = DANGEROUS; |
| 450 } else if (response.verdict() == ClientDownloadResponse::UNCOMMON) { |
| 451 reason = REASON_DOWNLOAD_UNCOMMON; |
| 452 result = UNCOMMON; |
450 } else { | 453 } else { |
451 reason = REASON_DOWNLOAD_SAFE; | 454 reason = REASON_DOWNLOAD_SAFE; |
452 } | 455 } |
453 } | 456 } |
454 // We don't need the fetcher anymore. | 457 // We don't need the fetcher anymore. |
455 fetcher_.reset(); | 458 fetcher_.reset(); |
456 RecordImprovedProtectionStats(reason); | 459 RecordImprovedProtectionStats(reason); |
457 UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestDuration", | 460 UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestDuration", |
458 base::TimeTicks::Now() - start_time_); | 461 base::TimeTicks::Now() - start_time_); |
459 FinishRequest(result); | 462 FinishRequest(result); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 860 |
858 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, | 861 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, |
859 sizeof(issuer.fingerprint().data)); | 862 sizeof(issuer.fingerprint().data)); |
860 for (std::set<std::string>::iterator it = paths_to_check.begin(); | 863 for (std::set<std::string>::iterator it = paths_to_check.begin(); |
861 it != paths_to_check.end(); ++it) { | 864 it != paths_to_check.end(); ++it) { |
862 whitelist_strings->push_back("cert/" + issuer_fp + *it); | 865 whitelist_strings->push_back("cert/" + issuer_fp + *it); |
863 } | 866 } |
864 } | 867 } |
865 | 868 |
866 } // namespace safe_browsing | 869 } // namespace safe_browsing |
OLD | NEW |