1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_ENTERPRISE_UTIL_H_
6 #define BASE_ENTERPRISE_UTIL_H_
8 #include "base/base_export.h"
9 #include "build/build_config.h"
13 // Returns true if an outside entity manages the current machine. To be
14 // "managed" means that an entity such as a company or school is applying
15 // policies to this device. This is primarily checking the device for MDM
17 // Not all managed devices are enterprise devices, as BYOD (bring your own
18 // device) is becoming more common in connection with workplace joining of
19 // personal computers.
20 BASE_EXPORT bool IsManagedDevice();
22 // Returns true if the device should be considered an enterprise device. To be
23 // an enterprise device means that the enterprise actually owns or has complete
24 // control over a device. This is primarily checking if the device is joined to
26 // Not all enterprise devices are managed devices because not all enterprises
27 // actually apply policies to all devices.
28 BASE_EXPORT bool IsEnterpriseDevice();
30 // Returns true if the device is either managed or enterprise. In general, it is
31 // recommended to use the PlatformManagementService to obtain this information,
33 BASE_EXPORT bool IsManagedOrEnterpriseDevice();
35 #if BUILDFLAG(IS_APPLE)
37 // Returns true if the device is being managed by an MDM system. Uses an old API
38 // not intended for the purpose.
39 enum class MacDeviceManagementStateOld {
40 kFailureAPIUnavailable = 0,
41 kFailureUnableToParseResult = 1,
45 kMaxValue = kMDMEnrollment
47 BASE_EXPORT MacDeviceManagementStateOld IsDeviceRegisteredWithManagementOld();
49 // Returns the state of the management of the device. Uses a new API so results
50 // aren't always available. For more details, this is documented at
51 // https://blog.fleetsmith.com/what-is-user-approved-mdm-uamdm/ .
53 // These values are persisted to logs. Entries must not be renumbered and
54 // numeric values must never be reused.
55 enum class MacDeviceManagementStateNew {
56 kFailureAPIUnavailable = 0,
57 kFailureUnableToParseResult = 1,
59 kLimitedMDMEnrollment = 3,
60 kFullMDMEnrollment = 4,
61 kDEPMDMEnrollment = 5,
63 kMaxValue = kDEPMDMEnrollment
65 BASE_EXPORT MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew();
67 // Returns whether the device and/or the current user is enrolled to a domain.
68 struct DeviceUserDomainJoinState {
72 BASE_EXPORT DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain();
74 #endif // BUILDFLAG(IS_APPLE)
78 #endif // BASE_ENTERPRISE_UTIL_H_