| 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/download/download_danger_prompt.h" | 5 #include "chrome/browser/download/download_danger_prompt.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 report.set_download_verdict(ClientDownloadResponse::DANGEROUS_HOST); | 335 report.set_download_verdict(ClientDownloadResponse::DANGEROUS_HOST); |
| 336 break; | 336 break; |
| 337 default: | 337 default: |
| 338 break; | 338 break; |
| 339 } | 339 } |
| 340 report.set_url(download.GetURL().spec()); | 340 report.set_url(download.GetURL().spec()); |
| 341 report.set_did_proceed(did_proceed); | 341 report.set_did_proceed(did_proceed); |
| 342 | 342 |
| 343 std::string serialized_report; | 343 std::string serialized_report; |
| 344 if (report.SerializeToString(&serialized_report)) | 344 if (report.SerializeToString(&serialized_report)) |
| 345 sb_service->SendDownloadRecoveryReport(serialized_report); | 345 sb_service->SendSerializedDownloadReport(serialized_report); |
| 346 else | 346 else |
| 347 DLOG(ERROR) << "Unable to serialize the threat report."; | 347 DLOG(ERROR) << "Unable to serialize the threat report."; |
| 348 } | 348 } |
| 349 | 349 |
| 350 void DownloadDangerPrompt::RecordDownloadDangerPrompt( | 350 void DownloadDangerPrompt::RecordDownloadDangerPrompt( |
| 351 bool did_proceed, | 351 bool did_proceed, |
| 352 const content::DownloadItem& download) { | 352 const content::DownloadItem& download) { |
| 353 int dangerous_file_type = | 353 int dangerous_file_type = |
| 354 GetSBClientDownloadExtensionValueForUMA(download.GetTargetFilePath()); | 354 GetSBClientDownloadExtensionValueForUMA(download.GetTargetFilePath()); |
| 355 content::DownloadDangerType danger_type = download.GetDangerType(); | 355 content::DownloadDangerType danger_type = download.GetDangerType(); |
| 356 | 356 |
| 357 UMA_HISTOGRAM_SPARSE_SLOWLY( | 357 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 358 base::StringPrintf("%s.%s.Shown", kDownloadDangerPromptPrefix, | 358 base::StringPrintf("%s.%s.Shown", kDownloadDangerPromptPrefix, |
| 359 GetDangerTypeString(danger_type)), | 359 GetDangerTypeString(danger_type)), |
| 360 dangerous_file_type); | 360 dangerous_file_type); |
| 361 if (did_proceed) { | 361 if (did_proceed) { |
| 362 UMA_HISTOGRAM_SPARSE_SLOWLY( | 362 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 363 base::StringPrintf("%s.%s.Proceed", kDownloadDangerPromptPrefix, | 363 base::StringPrintf("%s.%s.Proceed", kDownloadDangerPromptPrefix, |
| 364 GetDangerTypeString(danger_type)), | 364 GetDangerTypeString(danger_type)), |
| 365 dangerous_file_type); | 365 dangerous_file_type); |
| 366 } | 366 } |
| 367 } | 367 } |
| OLD | NEW |