OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 "components/safe_browsing/base_ping_manager.h" | 5 #include "components/safe_browsing/base_ping_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 fetcher->Start(); | 193 fetcher->Start(); |
194 safebrowsing_reports_.insert(std::move(fetcher)); | 194 safebrowsing_reports_.insert(std::move(fetcher)); |
195 } | 195 } |
196 | 196 |
197 GURL BasePingManager::SafeBrowsingHitUrl( | 197 GURL BasePingManager::SafeBrowsingHitUrl( |
198 const safe_browsing::HitReport& hit_report) const { | 198 const safe_browsing::HitReport& hit_report) const { |
199 DCHECK(hit_report.threat_type == SB_THREAT_TYPE_URL_MALWARE || | 199 DCHECK(hit_report.threat_type == SB_THREAT_TYPE_URL_MALWARE || |
200 hit_report.threat_type == SB_THREAT_TYPE_URL_PHISHING || | 200 hit_report.threat_type == SB_THREAT_TYPE_URL_PHISHING || |
201 hit_report.threat_type == SB_THREAT_TYPE_URL_UNWANTED || | 201 hit_report.threat_type == SB_THREAT_TYPE_URL_UNWANTED || |
202 hit_report.threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || | 202 hit_report.threat_type == SB_THREAT_TYPE_URL_BINARY_MALWARE || |
203 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || | 203 hit_report.threat_type == SB_THREAT_TYPE_URL_CLIENT_SIDE_PHISHING || |
204 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL || | 204 hit_report.threat_type == SB_THREAT_TYPE_URL_CLIENT_SIDE_MALWARE || |
205 hit_report.threat_type == | 205 hit_report.threat_type == |
206 SB_THREAT_TYPE_PASSWORD_PROTECTION_PHISHING_URL); | 206 SB_THREAT_TYPE_URL_PASSWORD_PROTECTION_PHISHING); |
207 std::string url = ProtocolManagerHelper::ComposeUrl( | 207 std::string url = ProtocolManagerHelper::ComposeUrl( |
208 url_prefix_, "report", client_name_, version_, std::string(), | 208 url_prefix_, "report", client_name_, version_, std::string(), |
209 hit_report.extended_reporting_level); | 209 hit_report.extended_reporting_level); |
210 | 210 |
211 std::string threat_list = "none"; | 211 std::string threat_list = "none"; |
212 switch (hit_report.threat_type) { | 212 switch (hit_report.threat_type) { |
213 case SB_THREAT_TYPE_URL_MALWARE: | 213 case SB_THREAT_TYPE_URL_MALWARE: |
214 threat_list = "malblhit"; | 214 threat_list = "malblhit"; |
215 break; | 215 break; |
216 case SB_THREAT_TYPE_URL_PHISHING: | 216 case SB_THREAT_TYPE_URL_PHISHING: |
217 threat_list = "phishblhit"; | 217 threat_list = "phishblhit"; |
218 break; | 218 break; |
219 case SB_THREAT_TYPE_URL_UNWANTED: | 219 case SB_THREAT_TYPE_URL_UNWANTED: |
220 threat_list = "uwsblhit"; | 220 threat_list = "uwsblhit"; |
221 break; | 221 break; |
222 case SB_THREAT_TYPE_BINARY_MALWARE_URL: | 222 case SB_THREAT_TYPE_URL_BINARY_MALWARE: |
223 threat_list = "binurlhit"; | 223 threat_list = "binurlhit"; |
224 break; | 224 break; |
225 case SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: | 225 case SB_THREAT_TYPE_URL_CLIENT_SIDE_PHISHING: |
226 threat_list = "phishcsdhit"; | 226 threat_list = "phishcsdhit"; |
227 break; | 227 break; |
228 case SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL: | 228 case SB_THREAT_TYPE_URL_CLIENT_SIDE_MALWARE: |
229 threat_list = "malcsdhit"; | 229 threat_list = "malcsdhit"; |
230 break; | 230 break; |
231 case SB_THREAT_TYPE_PASSWORD_PROTECTION_PHISHING_URL: | 231 case SB_THREAT_TYPE_URL_PASSWORD_PROTECTION_PHISHING: |
232 threat_list = "phishpphit"; | 232 threat_list = "phishpphit"; |
233 break; | 233 break; |
234 default: | 234 default: |
235 NOTREACHED(); | 235 NOTREACHED(); |
236 } | 236 } |
237 | 237 |
238 std::string threat_source = "none"; | 238 std::string threat_source = "none"; |
239 switch (hit_report.threat_source) { | 239 switch (hit_report.threat_source) { |
240 case safe_browsing::ThreatSource::DATA_SAVER: | 240 case safe_browsing::ThreatSource::DATA_SAVER: |
241 threat_source = "ds"; | 241 threat_source = "ds"; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 url_prefix_.c_str(), client_name_.c_str(), version_.c_str()); | 290 url_prefix_.c_str(), client_name_.c_str(), version_.c_str()); |
291 std::string api_key = google_apis::GetAPIKey(); | 291 std::string api_key = google_apis::GetAPIKey(); |
292 if (!api_key.empty()) { | 292 if (!api_key.empty()) { |
293 base::StringAppendF(&url, "&key=%s", | 293 base::StringAppendF(&url, "&key=%s", |
294 net::EscapeQueryParamValue(api_key, true).c_str()); | 294 net::EscapeQueryParamValue(api_key, true).c_str()); |
295 } | 295 } |
296 return GURL(url); | 296 return GURL(url); |
297 } | 297 } |
298 | 298 |
299 } // namespace safe_browsing | 299 } // namespace safe_browsing |
OLD | NEW |