OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/safe_browsing/ping_manager.h" | 5 #include "ios/chrome/browser/safe_browsing/ping_manager.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
11 #include "components/certificate_reporting/error_reporter.h" | 13 #include "components/certificate_reporting/error_reporter.h" |
12 #include "google_apis/google_api_keys.h" | 14 #include "google_apis/google_api_keys.h" |
13 #include "ios/web/public/web_thread.h" | 15 #include "ios/web/public/web_thread.h" |
14 #include "net/base/escape.h" | 16 #include "net/base/escape.h" |
15 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
16 #include "net/ssl/ssl_info.h" | 18 #include "net/ssl/ssl_info.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 129 |
128 void SafeBrowsingPingManager::ReportInvalidCertificateChain( | 130 void SafeBrowsingPingManager::ReportInvalidCertificateChain( |
129 const std::string& serialized_report) { | 131 const std::string& serialized_report) { |
130 DCHECK(certificate_error_reporter_); | 132 DCHECK(certificate_error_reporter_); |
131 certificate_error_reporter_->SendExtendedReportingReport(serialized_report); | 133 certificate_error_reporter_->SendExtendedReportingReport(serialized_report); |
132 } | 134 } |
133 | 135 |
134 void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting( | 136 void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting( |
135 scoped_ptr<certificate_reporting::ErrorReporter> | 137 scoped_ptr<certificate_reporting::ErrorReporter> |
136 certificate_error_reporter) { | 138 certificate_error_reporter) { |
137 certificate_error_reporter_ = certificate_error_reporter.Pass(); | 139 certificate_error_reporter_ = std::move(certificate_error_reporter); |
138 } | 140 } |
139 | 141 |
140 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( | 142 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( |
141 const safe_browsing::HitReport& hit_report) const { | 143 const safe_browsing::HitReport& hit_report) const { |
142 DCHECK(hit_report.threat_type == SB_THREAT_TYPE_URL_MALWARE || | 144 DCHECK(hit_report.threat_type == SB_THREAT_TYPE_URL_MALWARE || |
143 hit_report.threat_type == SB_THREAT_TYPE_URL_PHISHING || | 145 hit_report.threat_type == SB_THREAT_TYPE_URL_PHISHING || |
144 hit_report.threat_type == SB_THREAT_TYPE_URL_UNWANTED || | 146 hit_report.threat_type == SB_THREAT_TYPE_URL_UNWANTED || |
145 hit_report.threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || | 147 hit_report.threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || |
146 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || | 148 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || |
147 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL); | 149 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 url_prefix_.c_str(), client_name_.c_str(), version_.c_str()); | 209 url_prefix_.c_str(), client_name_.c_str(), version_.c_str()); |
208 std::string api_key = google_apis::GetAPIKey(); | 210 std::string api_key = google_apis::GetAPIKey(); |
209 if (!api_key.empty()) { | 211 if (!api_key.empty()) { |
210 base::StringAppendF(&url, "&key=%s", | 212 base::StringAppendF(&url, "&key=%s", |
211 net::EscapeQueryParamValue(api_key, true).c_str()); | 213 net::EscapeQueryParamValue(api_key, true).c_str()); |
212 } | 214 } |
213 return GURL(url); | 215 return GURL(url); |
214 } | 216 } |
215 | 217 |
216 } // namespace safe_browsing | 218 } // namespace safe_browsing |
OLD | NEW |