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. 4 5 #ifndef BASE_ENTERPRISE_UTIL_H_ 6 #define BASE_ENTERPRISE_UTIL_H_ 7 8 #include "base/base_export.h" 9 #include "build/build_config.h" 10 11 namespace base { 12 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 16 // management. 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(); 21 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 25 // a domain. 26 // Not all enterprise devices are managed devices because not all enterprises 27 // actually apply policies to all devices. 28 BASE_EXPORT bool IsEnterpriseDevice(); 29 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, 32 // if possible. 33 BASE_EXPORT bool IsManagedOrEnterpriseDevice(); 34 35 #if BUILDFLAG(IS_APPLE) 36 37 // Returns the state of the management of the device. For more details: 38 // https://blog.fleetsmith.com/what-is-user-approved-mdm-uamdm/ . 39 40 // These values are persisted to logs. Entries must not be renumbered and 41 // numeric values must never be reused. 42 enum class MacDeviceManagementState { 43 kFailureAPIUnavailable = 0, 44 kFailureUnableToParseResult = 1, 45 kNoEnrollment = 2, 46 kLimitedMDMEnrollment = 3, 47 kFullMDMEnrollment = 4, 48 kDEPMDMEnrollment = 5, 49 50 kMaxValue = kDEPMDMEnrollment 51 }; 52 BASE_EXPORT MacDeviceManagementState IsDeviceRegisteredWithManagement(); 53 54 // Returns whether the device and/or the current user is enrolled to a domain. 55 struct DeviceUserDomainJoinState { 56 bool device_joined; 57 bool user_joined; 58 }; 59 BASE_EXPORT DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain(); 60 61 #endif // BUILDFLAG(IS_APPLE) 62 63 } // namespace base 64 65 #endif // BASE_ENTERPRISE_UTIL_H_ 66