Chromium Code Reviews| Index: net/url_request/certificate_report_sender.cc |
| diff --git a/net/url_request/certificate_report_sender.cc b/net/url_request/certificate_report_sender.cc |
| index 55b27a592757d73fa0df3ffbb086315d2adfc2b6..a268c71efdf6f8a82937edccdd1e1e9180c36f10 100644 |
| --- a/net/url_request/certificate_report_sender.cc |
| +++ b/net/url_request/certificate_report_sender.cc |
| @@ -22,6 +22,14 @@ CertificateReportSender::CertificateReportSender( |
| : request_context_(request_context), |
|
eroman
2016/03/31 00:55:41
I suggest forwarding this to the new ctor:
: Ce
estark
2016/03/31 01:30:46
Done.
|
| cookies_preference_(cookies_preference) {} |
| +CertificateReportSender::CertificateReportSender( |
| + URLRequestContext* request_context, |
| + CookiesPreference cookies_preference, |
| + const base::Callback<void(URLRequest*)>& error_callback) |
| + : request_context_(request_context), |
| + cookies_preference_(cookies_preference), |
| + error_callback_(error_callback) {} |
| + |
| CertificateReportSender::~CertificateReportSender() { |
| // Cancel all of the uncompleted requests. |
| STLDeleteElements(&inflight_requests_); |
| @@ -52,9 +60,12 @@ void CertificateReportSender::Send(const GURL& report_uri, |
| } |
| void CertificateReportSender::OnResponseStarted(URLRequest* request) { |
| - // TODO(estark): call a callback so that the caller can print a |
| - // warning on failure. |
| - DVLOG(1) << "Failed to send certificate report for " << request->url().host(); |
| + if (!request->status().is_success()) { |
| + DVLOG(1) << "Failed to send certificate report for " |
| + << request->url().host(); |
| + if (!error_callback_.is_null()) |
| + error_callback_.Run(request); |
| + } |
| CHECK_GT(inflight_requests_.erase(request), 0u); |
| // Clean up the request, which cancels it. |