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

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: eroman comment 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..6091701cbddfd4d4ff0f40f37b9b255570573466 100644
--- a/net/url_request/certificate_report_sender.cc
+++ b/net/url_request/certificate_report_sender.cc
@@ -19,8 +19,17 @@ namespace net {
CertificateReportSender::CertificateReportSender(
URLRequestContext* request_context,
CookiesPreference cookies_preference)
+ : CertificateReportSender(request_context,
+ cookies_preference,
+ base::Callback<void(URLRequest*)>()) {}
+
+CertificateReportSender::CertificateReportSender(
+ URLRequestContext* request_context,
+ CookiesPreference cookies_preference,
+ const base::Callback<void(URLRequest*)>& error_callback)
: request_context_(request_context),
- cookies_preference_(cookies_preference) {}
+ cookies_preference_(cookies_preference),
+ error_callback_(error_callback) {}
CertificateReportSender::~CertificateReportSender() {
// Cancel all of the uncompleted requests.
@@ -52,9 +61,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