#include "chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/enterprise/connectors/device_trust/common/common_types.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/ash/components/install_attributes/install_attributes.h"
#endif
namespace enterprise_connectors {
namespace {
#if BUILDFLAG(IS_CHROMEOS_ASH)
enum class DTEnrollmentStatus {
kManaged = 0,
kUnmanaged = 1,
kMaxValue = kUnmanaged,
};
#endif
DTHandshakeResult ResponseToResult(const DeviceTrustResponse& response) { … }
bool ContainsPolicyLevel(const std::set<DTCPolicyLevel>& levels,
const DTCPolicyLevel& level) { … }
DTAttestationPolicyLevel GetAttestationPolicyLevel(
const std::set<DTCPolicyLevel>& levels) { … }
}
void LogAttestationFunnelStep(DTAttestationFunnelStep step) { … }
void LogAttestationPolicyLevel(const std::set<DTCPolicyLevel>& levels) { … }
void LogAttestationResult(DTAttestationResult result) { … }
void LogDeviceTrustResponse(const DeviceTrustResponse& response,
base::TimeTicks start_time) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void LogOrigin(DTOrigin origin) {
static constexpr char kOriginHistogram[] = "Enterprise.DeviceTrust.Origin";
base::UmaHistogramEnumeration(kOriginHistogram, origin);
}
void LogEnrollmentStatus() {
static constexpr char kEnrollmentStatusHistogram[] =
"Enterprise.DeviceTrust.EnrollmentStatus";
base::UmaHistogramEnumeration(
kEnrollmentStatusHistogram,
ash::InstallAttributes::Get()->IsEnterpriseManaged()
? DTEnrollmentStatus::kManaged
: DTEnrollmentStatus::kUnmanaged);
}
#endif
}