blob: 8bde3a09b4db63db898536842e89848b214c8efd [file] [log] [blame]
Hector Carmonac3565bc42019-02-01 23:31:211// 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 Drissmand066bae2020-01-17 19:17:019#include "build/build_config.h"
Hector Carmonac3565bc42019-02-01 23:31:2110
11namespace 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.
17BASE_EXPORT bool IsMachineExternallyManaged();
18
Avi Drissman5b286372020-07-28 21:59:3819#if defined(OS_APPLE)
Avi Drissmand066bae2020-01-17 19:17:0120
21// Returns true if the device is being managed by an MDM system. Uses an old API
22// not intended for the purpose.
23enum class MacDeviceManagementStateOld {
24 kFailureAPIUnavailable = 0,
25 kFailureUnableToParseResult = 1,
26 kNoEnrollment = 2,
27 kMDMEnrollment = 3,
28
29 kMaxValue = kMDMEnrollment
30};
31BASE_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.
39enum 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};
49BASE_EXPORT MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew();
50
51// Returns whether the device and/or the current user is enrolled to a domain.
52struct DeviceUserDomainJoinState {
53 bool device_joined;
54 bool user_joined;
55};
56BASE_EXPORT DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain();
57
Avi Drissman78281f32020-07-31 03:09:0358#endif // OS_APPLE
Avi Drissmand066bae2020-01-17 19:17:0159
Hector Carmonac3565bc42019-02-01 23:31:2160} // namespace base
61
62#endif // BASE_ENTERPRISE_UTIL_H_