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

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

Issue 2632533002: Add retry information to certificate reports. (Closed)
Patch Set: Enums Created 3 years, 11 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
Index: chrome/browser/safe_browsing/certificate_reporting_service.cc
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service.cc b/chrome/browser/safe_browsing/certificate_reporting_service.cc
index d0fb362c53701d89d6850c56ae7a62a5e22eff63..ad70493acf8635a0a4c10ca1370cdb5d5f4ec16b 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service.cc
+++ b/chrome/browser/safe_browsing/certificate_reporting_service.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
+#include "components/certificate_reporting/error_report.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing_db/safe_browsing_prefs.h"
#include "content/public/browser/browser_thread.h"
@@ -109,11 +110,20 @@ void CertificateReportingService::Reporter::SendPending() {
// Copy pending reports and clear the retry list.
std::vector<Report> items = retry_list_->items();
retry_list_->Clear();
- for (const Report& report : items) {
+ for (Report& report : items) {
if (report.creation_time < now - report_ttl_) {
// Report too old, ignore.
continue;
}
+ if (!report.is_retried) {
+ // If this is the first retry, deserialize the report, set its retry bit
+ // and serialize again.
+ certificate_reporting::ErrorReport error_report;
+ CHECK(error_report.InitializeFromString(report.serialized_report));
+ error_report.SetIsRetryUpload(true);
+ CHECK(error_report.Serialize(&report.serialized_report));
+ }
+ report.is_retried = true;
SendInternal(report);
}
}

Powered by Google App Engine
This is Rietveld 408576698