#include "components/policy/core/common/cloud/cloud_policy_util.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
#include "components/policy/proto/device_management_backend.pb.h"
#if BUILDFLAG(IS_WIN)
#include <Windows.h>
#define SECURITY_WIN32 …
#include <security.h>
#undef SECURITY_WIN32
#include <wincred.h>
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FUCHSIA)
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#if BUILDFLAG(IS_APPLE)
#include <stddef.h>
#include <sys/sysctl.h>
#endif
#if BUILDFLAG(IS_MAC)
#import <SystemConfiguration/SCDynamicStoreCopySpecific.h>
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
#include <limits.h>
#endif
#include <algorithm>
#include <utility>
#include "base/check.h"
#include "base/notreached.h"
#include "base/system/sys_info.h"
#if BUILDFLAG(IS_WIN)
#include "base/functional/callback.h"
#include "base/task/thread_pool.h"
#include "base/win/wmi.h"
#endif
#include "components/version_info/version_info.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chromeos/ash/components/system/statistics_provider.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/startup/browser_params_proxy.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "base/system/sys_info.h"
#endif
#if BUILDFLAG(IS_APPLE)
#include "base/apple/scoped_cftyperef.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
#endif
#if BUILDFLAG(IS_IOS)
#include "base/ios/device_util.h"
#endif
namespace policy {
em;
std::string GetMachineName() { … }
std::string GetOSVersion() { … }
std::string GetOSPlatform() { … }
std::string GetOSArchitecture() { … }
std::string GetOSUsername() { … }
em::Channel ConvertToProtoChannel(version_info::Channel channel) { … }
std::string GetDeviceName() { … }
std::unique_ptr<em::BrowserDeviceIdentifier> GetBrowserDeviceIdentifier() { … }
#if BUILDFLAG(IS_WIN)
void GetBrowserDeviceIdentifierAsync(
base::OnceCallback<
void(std::unique_ptr<enterprise_management::BrowserDeviceIdentifier>)>
callback) {
base::ThreadPool::CreateCOMSTATaskRunner(
{base::MayBlock(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})
->PostTaskAndReplyWithResult(FROM_HERE,
base::BindOnce(&GetBrowserDeviceIdentifier),
std::move(callback));
}
#endif
bool IsMachineLevelUserCloudPolicyType(const std::string& type) { … }
}