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

Unified Diff: chrome/browser/metrics/metrics_reporting_state.cc

Issue 1951553002: Enabled client side sampling for user metrics reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/metrics/metrics_reporting_state.cc
diff --git a/chrome/browser/metrics/metrics_reporting_state.cc b/chrome/browser/metrics/metrics_reporting_state.cc
index 9e74f158f3c558422940129dbb06ffa5a7aaa118..1b748a6ac32d765028873f23f51b2f43bb637299 100644
--- a/chrome/browser/metrics/metrics_reporting_state.cc
+++ b/chrome/browser/metrics/metrics_reporting_state.cc
@@ -13,6 +13,7 @@
#include "chrome/installer/util/google_update_settings.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/metrics/metrics_service.h"
+#include "components/metrics_services_manager/metrics_services_manager.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
@@ -60,18 +61,15 @@ void SetMetricsReporting(bool to_update_pref,
const OnMetricsReportingCallbackType& callback_fn,
bool updated_pref) {
metrics::MetricsService* metrics = g_browser_process->metrics_service();
- if (metrics) {
- if (updated_pref)
- metrics->Start();
- else
- metrics->Stop();
- }
#if !defined(OS_ANDROID)
g_browser_process->local_state()->SetBoolean(
metrics::prefs::kMetricsReportingEnabled, updated_pref);
#endif // !defined(OS_ANDROID)
+ // Uses the current state of whether reporting is enabled to enabled services.
+ g_browser_process->GetMetricsServicesManager()->UpdateUploadPermissions(true);
Alexei Svitkine (slow) 2016/07/19 15:23:59 Shouldn't this be updated_pref value and not |true
jwd 2016/07/19 21:21:49 No, the true refers to the "can upload" permission
+
// When a user opts in to the metrics reporting service, the previously
// collected data should be cleared to ensure that nothing is reported before
// a user opts in and all reported data is accurate.

Powered by Google App Engine
This is Rietveld 408576698