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

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

Issue 2503243003: Wire up CertificateReportingService to handle report uploads (Closed)
Patch Set: More documentation for CertificateReportingMetricsProvider 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..5b42e59669c1388e4caf2a40ba3188b636f19d71 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
+ // metrisc to the metrics service. It doesn't provide any metrics though,
Ilya Sherman 2016/12/23 00:56:48 nit: s/metrisc/metrics
meacer 2016/12/27 18:56:43 Done.
+ // 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