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/ping_manager.h" | 5 #include "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 "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
13 #include "google_apis/google_api_keys.h" | 15 #include "google_apis/google_api_keys.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 131 |
130 void SafeBrowsingPingManager::ReportInvalidCertificateChain( | 132 void SafeBrowsingPingManager::ReportInvalidCertificateChain( |
131 const std::string& serialized_report) { | 133 const std::string& serialized_report) { |
132 DCHECK(certificate_error_reporter_); | 134 DCHECK(certificate_error_reporter_); |
133 certificate_error_reporter_->SendExtendedReportingReport(serialized_report); | 135 certificate_error_reporter_->SendExtendedReportingReport(serialized_report); |
134 } | 136 } |
135 | 137 |
136 void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting( | 138 void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting( |
137 scoped_ptr<certificate_reporting::ErrorReporter> | 139 scoped_ptr<certificate_reporting::ErrorReporter> |
138 certificate_error_reporter) { | 140 certificate_error_reporter) { |
139 certificate_error_reporter_ = certificate_error_reporter.Pass(); | 141 certificate_error_reporter_ = std::move(certificate_error_reporter); |
140 } | 142 } |
141 | 143 |
142 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( | 144 GURL SafeBrowsingPingManager::SafeBrowsingHitUrl( |
143 const safe_browsing::HitReport& hit_report) const { | 145 const safe_browsing::HitReport& hit_report) const { |
144 DCHECK(hit_report.threat_type == SB_THREAT_TYPE_URL_MALWARE || | 146 DCHECK(hit_report.threat_type == SB_THREAT_TYPE_URL_MALWARE || |
145 hit_report.threat_type == SB_THREAT_TYPE_URL_PHISHING || | 147 hit_report.threat_type == SB_THREAT_TYPE_URL_PHISHING || |
146 hit_report.threat_type == SB_THREAT_TYPE_URL_UNWANTED || | 148 hit_report.threat_type == SB_THREAT_TYPE_URL_UNWANTED || |
147 hit_report.threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || | 149 hit_report.threat_type == SB_THREAT_TYPE_BINARY_MALWARE_URL || |
148 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || | 150 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL || |
149 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL); | 151 hit_report.threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 version_.c_str()); | 213 version_.c_str()); |
212 std::string api_key = google_apis::GetAPIKey(); | 214 std::string api_key = google_apis::GetAPIKey(); |
213 if (!api_key.empty()) { | 215 if (!api_key.empty()) { |
214 base::StringAppendF(&url, "&key=%s", | 216 base::StringAppendF(&url, "&key=%s", |
215 net::EscapeQueryParamValue(api_key, true).c_str()); | 217 net::EscapeQueryParamValue(api_key, true).c_str()); |
216 } | 218 } |
217 return GURL(url); | 219 return GURL(url); |
218 } | 220 } |
219 | 221 |
220 } // namespace safe_browsing | 222 } // namespace safe_browsing |
OLD | NEW |