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

Unified Diff: net/url_request/certificate_report_sender.cc

Issue 1847563004: Add error callback to net::CertificateReportSender (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/certificate_report_sender.h ('k') | net/url_request/certificate_report_sender_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « net/url_request/certificate_report_sender.h ('k') | net/url_request/certificate_report_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698