Hector Carmona | c3565bc4 | 2019-02-01 23:31:21 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef BASE_ENTERPRISE_UTIL_H_ |
| 6 | #define BASE_ENTERPRISE_UTIL_H_ |
| 7 | |
| 8 | #include "base/base_export.h" |
Avi Drissman | d066bae | 2020-01-17 19:17:01 | [diff] [blame] | 9 | #include "build/build_config.h" |
Hector Carmona | c3565bc4 | 2019-02-01 23:31:21 | [diff] [blame] | 10 | |
| 11 | namespace base { |
| 12 | |
| 13 | // Returns true if an outside entity manages the current machine. This includes |
| 14 | // but is not limited to the presence of user accounts from a centralized |
| 15 | // directory or the presence of dynamically updatable machine policies from an |
| 16 | // outside administrator. |
| 17 | BASE_EXPORT bool IsMachineExternallyManaged(); |
| 18 | |
Avi Drissman | 5b28637 | 2020-07-28 21:59:38 | [diff] [blame] | 19 | #if defined(OS_APPLE) |
Avi Drissman | d066bae | 2020-01-17 19:17:01 | [diff] [blame] | 20 | |
| 21 | // Returns true if the device is being managed by an MDM system. Uses an old API |
| 22 | // not intended for the purpose. |
| 23 | enum class MacDeviceManagementStateOld { |
| 24 | kFailureAPIUnavailable = 0, |
| 25 | kFailureUnableToParseResult = 1, |
| 26 | kNoEnrollment = 2, |
| 27 | kMDMEnrollment = 3, |
| 28 | |
| 29 | kMaxValue = kMDMEnrollment |
| 30 | }; |
| 31 | BASE_EXPORT MacDeviceManagementStateOld IsDeviceRegisteredWithManagementOld(); |
| 32 | |
| 33 | // Returns the state of the management of the device. Uses a new API so results |
| 34 | // aren't always available. For more details, this is documented at |
| 35 | // https://blog.fleetsmith.com/what-is-user-approved-mdm-uamdm/ . |
| 36 | |
| 37 | // These values are persisted to logs. Entries must not be renumbered and |
| 38 | // numeric values must never be reused. |
| 39 | enum class MacDeviceManagementStateNew { |
| 40 | kFailureAPIUnavailable = 0, |
| 41 | kFailureUnableToParseResult = 1, |
| 42 | kNoEnrollment = 2, |
| 43 | kLimitedMDMEnrollment = 3, |
| 44 | kFullMDMEnrollment = 4, |
| 45 | kDEPMDMEnrollment = 5, |
| 46 | |
| 47 | kMaxValue = kDEPMDMEnrollment |
| 48 | }; |
| 49 | BASE_EXPORT MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew(); |
| 50 | |
| 51 | // Returns whether the device and/or the current user is enrolled to a domain. |
| 52 | struct DeviceUserDomainJoinState { |
| 53 | bool device_joined; |
| 54 | bool user_joined; |
| 55 | }; |
| 56 | BASE_EXPORT DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain(); |
| 57 | |
Avi Drissman | 78281f3 | 2020-07-31 03:09:03 | [diff] [blame] | 58 | #endif // OS_APPLE |
Avi Drissman | d066bae | 2020-01-17 19:17:01 | [diff] [blame] | 59 | |
Hector Carmona | c3565bc4 | 2019-02-01 23:31:21 | [diff] [blame] | 60 | } // namespace base |
| 61 | |
| 62 | #endif // BASE_ENTERPRISE_UTIL_H_ |