Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(328)

Side by Side Diff: chrome/browser/download/download_danger_prompt.cc

Issue 1943993006: Create test fixture for SafeBrowsingService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h" 7 #include "base/macros.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 break; 63 break;
64 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: 64 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT:
65 report.set_download_verdict(ClientDownloadResponse::UNCOMMON); 65 report.set_download_verdict(ClientDownloadResponse::UNCOMMON);
66 break; 66 break;
67 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: 67 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED:
68 report.set_download_verdict(ClientDownloadResponse::POTENTIALLY_UNWANTED); 68 report.set_download_verdict(ClientDownloadResponse::POTENTIALLY_UNWANTED);
69 break; 69 break;
70 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: 70 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST:
71 report.set_download_verdict(ClientDownloadResponse::DANGEROUS_HOST); 71 report.set_download_verdict(ClientDownloadResponse::DANGEROUS_HOST);
72 break; 72 break;
73 default: 73 default: // Don't send report for any other danger types.
74 break; 74 return;
75 } 75 }
76 report.set_url(download.GetURL().spec()); 76 report.set_url(download.GetURL().spec());
77 report.set_did_proceed(did_proceed); 77 report.set_did_proceed(did_proceed);
78 78
79 std::string serialized_report; 79 std::string serialized_report;
80 if (report.SerializeToString(&serialized_report)) 80 if (report.SerializeToString(&serialized_report))
81 sb_service->SendSerializedDownloadReport(serialized_report); 81 sb_service->SendSerializedDownloadReport(serialized_report);
82 else 82 else
83 DLOG(ERROR) << "Unable to serialize the threat report."; 83 DLOG(ERROR) << "Unable to serialize the threat report.";
84 } 84 }
(...skipping 10 matching lines...) Expand all
95 base::StringPrintf("%s.%s.Shown", kDownloadDangerPromptPrefix, 95 base::StringPrintf("%s.%s.Shown", kDownloadDangerPromptPrefix,
96 GetDangerTypeString(danger_type)), 96 GetDangerTypeString(danger_type)),
97 file_type_uma_value); 97 file_type_uma_value);
98 if (did_proceed) { 98 if (did_proceed) {
99 UMA_HISTOGRAM_SPARSE_SLOWLY( 99 UMA_HISTOGRAM_SPARSE_SLOWLY(
100 base::StringPrintf("%s.%s.Proceed", kDownloadDangerPromptPrefix, 100 base::StringPrintf("%s.%s.Proceed", kDownloadDangerPromptPrefix,
101 GetDangerTypeString(danger_type)), 101 GetDangerTypeString(danger_type)),
102 file_type_uma_value); 102 file_type_uma_value);
103 } 103 }
104 } 104 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | chrome/browser/download/download_danger_prompt_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698