#include "components/policy/core/common/policy_statistics_collector.h"
#include <algorithm>
#include <string>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/task/task_runner.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/core/common/cloud/enterprise_metrics.h"
#include "components/policy/core/common/policy_map.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/policy/core/common/policy_service.h"
#include "components/policy/core/common/policy_types.h"
#include "components/policy/policy_constants.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
namespace policy {
namespace {
constexpr char kPoliciesSourceMetricsName[] = …;
#if !BUILDFLAG(IS_CHROMEOS)
constexpr char kBrowserSigninModeMetricsName[] = …;
#endif
constexpr const char* kCBCMEnrollmentPolicies[] = …;
enum SimplePolicySource { … };
SimplePolicySource SimplifyPolicySource(PolicySource source,
const std::string& policy_name) { … }
void RecordPoliciesSources(SimplePolicySource source) { … }
#if !BUILDFLAG(IS_CHROMEOS)
void RecordBrowserSigninMode(const base::Value* value) { … }
#endif
}
const base::TimeDelta PolicyStatisticsCollector::kStatisticsUpdateRate = …;
PolicyStatisticsCollector::PolicyStatisticsCollector(
const GetChromePolicyDetailsCallback& get_details,
const Schema& chrome_schema,
PolicyService* policy_service,
PrefService* prefs,
const scoped_refptr<base::TaskRunner>& task_runner)
: … { … }
PolicyStatisticsCollector::~PolicyStatisticsCollector() = default;
void PolicyStatisticsCollector::Initialize() { … }
void PolicyStatisticsCollector::RegisterPrefs(PrefRegistrySimple* registry) { … }
void PolicyStatisticsCollector::RecordPolicyUse(int id, Condition condition) { … }
void PolicyStatisticsCollector::CollectStatistics() { … }
void PolicyStatisticsCollector::ScheduleUpdate(base::TimeDelta delay) { … }
}