#include "chrome/browser/metrics/metrics_reporting_state.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/common/pref_names.h"
#include "chrome/installer/util/google_update_settings.h"
#include "components/crash/core/common/crash_keys.h"
#include "components/metrics/cloned_install_detector.h"
#include "components/metrics/entropy_state.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"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h"
#include "chrome/browser/browser_process_platform_part.h"
#endif
#if BUILDFLAG(IS_ANDROID)
#include "components/policy/core/common/features.h"
#endif
namespace {
enum MetricsReportingChangeHistogramValue { … };
void RecordMetricsReportingHistogramValue(
MetricsReportingChangeHistogramValue value) { … }
bool SetGoogleUpdateSettings(bool enabled) { … }
void SetMetricsReporting(bool to_update_pref,
OnMetricsReportingCallbackType callback_fn,
ChangeMetricsReportingStateCalledFrom called_from,
bool updated_pref) { … }
}
void ChangeMetricsReportingState(
bool enabled,
ChangeMetricsReportingStateCalledFrom called_from) { … }
void ChangeMetricsReportingStateWithReply(
bool enabled,
OnMetricsReportingCallbackType callback_fn,
ChangeMetricsReportingStateCalledFrom called_from) { … }
void UpdateMetricsPrefsOnPermissionChange(
bool metrics_enabled,
ChangeMetricsReportingStateCalledFrom called_from) { … }
void ApplyMetricsReportingPolicy() { … }
bool IsMetricsReportingPolicyManaged() { … }
void ClearPreviouslyCollectedMetricsData() { … }