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

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

Issue 2503243003: Wire up CertificateReportingService to handle report uploads (Closed)
Patch Set: Rebase Created 4 years 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_metrics_provider.cc
diff --git a/chrome/browser/safe_browsing/certificate_reporting_metrics_provider.cc b/chrome/browser/safe_browsing/certificate_reporting_metrics_provider.cc
index b7304bc2d3d662bde51aa73d9cbc08fb4bb29d9b..23dfccbc66cb304160784b036e39d2b48bb6b066 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_metrics_provider.cc
+++ b/chrome/browser/safe_browsing/certificate_reporting_metrics_provider.cc
@@ -14,4 +14,23 @@ CertificateReportingMetricsProvider::CertificateReportingMetricsProvider() {}
CertificateReportingMetricsProvider::~CertificateReportingMetricsProvider() {}
void CertificateReportingMetricsProvider::ProvideGeneralMetrics(
- metrics::ChromeUserMetricsExtension* unused) {}
+ metrics::ChromeUserMetricsExtension* unused) {
+ // When ProvideGeneralMetrics is called, this class is being asked to provide
+ // metrics to the metrics service. It doesn't provide any metrics though,
+ // instead it tells CertificateReportingService to upload any pending reports.
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ if (!profile_manager)
+ return;
+
+ // Do not try to create profile here if it does not exist, because this method
+ // can be called during browser shutdown.
+ Profile* profile = profile_manager->GetProfileByPath(
+ profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir()));
+ if (!profile)
+ return;
+
+ CertificateReportingService* service =
+ CertificateReportingServiceFactory::GetForBrowserContext(profile);
+ if (service)
+ service->SendPending();
+}

Powered by Google App Engine
This is Rietveld 408576698