Files
rk35xx-android14/external/cronet/components/metrics/machine_id_provider_nonwin.cc
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

31 lines
956 B
C++

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/metrics/machine_id_provider.h"
#include <stdint.h>
#include "base/check.h"
#include "base/system/sys_info.h"
namespace metrics {
// Checks if hardware model name is available.
bool MachineIdProvider::HasId() {
return !base::SysInfo::HardwareModelName().empty();
}
// On non-windows, the machine id is based on the hardware model name.
// This will suffice as users are unlikely to change to the same machine model.
std::string MachineIdProvider::GetMachineId() {
// Gets hardware model name. (e.g. 'Macbook Pro 16,1', 'iPhone 9,3')
std::string hardware_model_name = base::SysInfo::HardwareModelName();
// This function should not be called if hardware model name is unavailable.
DCHECK(!hardware_model_name.empty());
return hardware_model_name;
}
} // namespace metrics