Chromium Code Reviews| 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..f8cdfdc63b15d4a8180334d4ec02457e0d121b17 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,26 @@ 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; |
| + if (!error_report.InitializeFromString(report.serialized_report)) { |
| + LOG(ERROR) << "Cannot deserialize report"; |
|
estark
2017/01/13 23:26:22
Is this possible? maybe should just be DCHECK(erro
meacer
2017/01/17 22:24:27
cert_report_helper seemed to imply it was possible
|
| + continue; |
| + } |
| + error_report.SetIsRetryUpload(true); |
| + if (!error_report.Serialize(&report.serialized_report)) { |
| + LOG(ERROR) << "Cannot serialize report"; |
| + continue; |
| + } |
| + } |
| + report.is_retried = true; |
| SendInternal(report); |
| } |
| } |