[M108 Migration][VD] Support set time and time zone offset
[platform/framework/web/chromium-efl.git] / base / enterprise_util.h
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 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,
42   kNoEnrollment = 2,
43   kMDMEnrollment = 3,
44
45   kMaxValue = kMDMEnrollment
46 };
47 BASE_EXPORT MacDeviceManagementStateOld IsDeviceRegisteredWithManagementOld();
48
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/ .
52
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,
58   kNoEnrollment = 2,
59   kLimitedMDMEnrollment = 3,
60   kFullMDMEnrollment = 4,
61   kDEPMDMEnrollment = 5,
62
63   kMaxValue = kDEPMDMEnrollment
64 };
65 BASE_EXPORT MacDeviceManagementStateNew IsDeviceRegisteredWithManagementNew();
66
67 // Returns whether the device and/or the current user is enrolled to a domain.
68 struct DeviceUserDomainJoinState {
69   bool device_joined;
70   bool user_joined;
71 };
72 BASE_EXPORT DeviceUserDomainJoinState AreDeviceAndUserJoinedToDomain();
73
74 #endif  // BUILDFLAG(IS_APPLE)
75
76 }  // namespace base
77
78 #endif  // BASE_ENTERPRISE_UTIL_H_