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

Unified Diff: chrome/browser/safe_browsing/ping_manager.cc

Issue 2483993002: Add report_id to ErrorReporter interface. (Closed)
Patch Set: Created 4 years, 1 month 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
Index: chrome/browser/safe_browsing/ping_manager.cc
diff --git a/chrome/browser/safe_browsing/ping_manager.cc b/chrome/browser/safe_browsing/ping_manager.cc
index f16f8181f8e66df59adc2073cd9161036a34d455..78b5960e30d091c265355cd8281a725c5c10e373 100644
--- a/chrome/browser/safe_browsing/ping_manager.cc
+++ b/chrome/browser/safe_browsing/ping_manager.cc
@@ -9,6 +9,8 @@
#include "base/base64.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/histogram_macros.h"
+#include "base/metrics/sparse_histogram.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -67,6 +69,12 @@ std::unique_ptr<base::Value> NetLogPingEndCallback(
return std::move(event_params);
}
+// Records an UMA histogram of the net errors when certificate reports
+// fail to send.
+void RecordUMAOnFailure(const GURL& report_uri, int net_error, int report_id) {
+ UMA_HISTOGRAM_SPARSE_SLOWLY("SSL.CertificateErrorReportFailure", -net_error);
+}
+
} // namespace
namespace safe_browsing {
@@ -99,6 +107,8 @@ SafeBrowsingPingManager::SafeBrowsingPingManager(
certificate_error_reporter_.reset(new certificate_reporting::ErrorReporter(
request_context_getter->GetURLRequestContext(), certificate_upload_url,
cookies_preference));
+ certificate_error_reporter_->SetErrorCallback(
+ base::Bind(&RecordUMAOnFailure));
permission_reporter_.reset(
new PermissionReporter(request_context_getter->GetURLRequestContext()));
@@ -186,7 +196,8 @@ void SafeBrowsingPingManager::ReportThreatDetails(const std::string& report) {
void SafeBrowsingPingManager::ReportInvalidCertificateChain(
const std::string& serialized_report) {
DCHECK(certificate_error_reporter_);
- certificate_error_reporter_->SendExtendedReportingReport(serialized_report);
+ certificate_error_reporter_->SendExtendedReportingReport(serialized_report,
+ 0);
}
void SafeBrowsingPingManager::SetCertificateErrorReporterForTesting(

Powered by Google App Engine
This is Rietveld 408576698