enterprise_util.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #ifndef BASE_ENTERPRISE_UTIL_H_
  5. #define BASE_ENTERPRISE_UTIL_H_
  6. #include "base/base_export.h"
  7. #include "build/build_config.h"
  8. namespace base {
  9. // Returns true if an outside entity manages the current machine. This includes
  10. // but is not limited to the presence of user accounts from a centralized
  11. // directory or the presence of dynamically updatable machine policies from an
  12. // outside administrator.
  13. BASE_EXPORT bool IsMachineExternallyManaged();
  14. #if defined(OS_APPLE)
  15. // Returns true if the device is being managed by an MDM system. Uses an old API
  16. // not intended for the purpose.
  17. enum class MacDeviceManagementStateOld {
  18. kFailureAPIUnavailable = 0,
  19. kFailureUnableToParseResult = 1,
  20. kNoEnrollment = 2,
  21. kMDMEnrollment = 3,
  22. kMaxValue = kMDMEnrollment
  23. };
  24. BASE_EXPORT MacDeviceManagementStateOld IsDeviceRegisteredWithManagementOld();
  25. // Returns the state of the management of the device. Uses a new API so results
  26. // aren't always available. For more details, this is documented at
  27. // https://blog.fleetsmith.com/what-is-user-approved-mdm-uamdm/ .
  28. // These values are persisted to logs. Entries must not be renumbered and
  29. // numeric values must never be reused.
  30. enum class MacDeviceManagementStateNew {
  31. kFailureAPIUnavailable = 0,
  32. kFailureUnableToParseResult = 1,
  33. kNoEnrollment = 2,
  34. kLimitedMDMEnrollment = 3,
  35. kFullMDMEnrollment = 4,
  36. kDEPMDMEnrollment = 5,
  37. kMaxValue = kDEPMDMEnrollment
  38. };
  39. BASE_EXPORT MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew();
  40. // Returns whether the device and/or the current user is enrolled to a domain.
  41. struct DeviceUserDomainJoinState {
  42. bool device_joined;
  43. bool user_joined;
  44. };
  45. BASE_EXPORT DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain();
  46. #endif // OS_APPLE
  47. } // namespace base
  48. #endif // BASE_ENTERPRISE_UTIL_H_