Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / components / policy / core / common / cloud / cloud_policy_constants.h
bloba1732754e673784a3cdd4b79a380f128c7f96c57
1 // Copyright (c) 2012 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.
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_
8 #include <string>
10 #include "components/policy/policy_export.h"
12 namespace enterprise_management {
13 class PolicyData;
16 namespace policy {
18 // Constants related to the device management protocol.
19 namespace dm_protocol {
21 // Name extern constants for URL query parameters.
22 POLICY_EXPORT extern const char kParamAgent[];
23 POLICY_EXPORT extern const char kParamAppType[];
24 POLICY_EXPORT extern const char kParamDeviceID[];
25 POLICY_EXPORT extern const char kParamDeviceType[];
26 POLICY_EXPORT extern const char kParamOAuthToken[];
27 POLICY_EXPORT extern const char kParamPlatform[];
28 POLICY_EXPORT extern const char kParamRequest[];
30 // String extern constants for the device and app type we report to the server.
31 POLICY_EXPORT extern const char kValueAppType[];
32 POLICY_EXPORT extern const char kValueDeviceType[];
33 POLICY_EXPORT extern const char kValueRequestAutoEnrollment[];
34 POLICY_EXPORT extern const char kValueRequestPolicy[];
35 POLICY_EXPORT extern const char kValueRequestRegister[];
36 POLICY_EXPORT extern const char kValueRequestApiAuthorization[];
37 POLICY_EXPORT extern const char kValueRequestUnregister[];
38 POLICY_EXPORT extern const char kValueRequestUploadCertificate[];
39 POLICY_EXPORT extern const char kValueRequestDeviceStateRetrieval[];
40 POLICY_EXPORT extern const char kValueRequestUploadStatus[];
41 POLICY_EXPORT extern const char kValueRequestRemoteCommands[];
42 POLICY_EXPORT extern const char kValueRequestDeviceAttributeUpdatePermission[];
43 POLICY_EXPORT extern const char kValueRequestDeviceAttributeUpdate[];
44 POLICY_EXPORT extern const char kValueRequestGcmIdUpdate[];
46 // Policy type strings for the policy_type field in PolicyFetchRequest.
47 POLICY_EXPORT extern const char kChromeDevicePolicyType[];
48 POLICY_EXPORT extern const char kChromeUserPolicyType[];
49 POLICY_EXPORT extern const char kChromePublicAccountPolicyType[];
50 POLICY_EXPORT extern const char kChromeExtensionPolicyType[];
52 // These codes are sent in the |error_code| field of PolicyFetchResponse.
53 enum PolicyFetchStatus {
54 POLICY_FETCH_SUCCESS = 200,
55 POLICY_FETCH_ERROR_NOT_FOUND = 902,
58 } // namespace dm_protocol
60 // The header used to transmit the policy ID for this client.
61 POLICY_EXPORT extern const char kChromePolicyHeader[];
63 // Information about the verification key used to verify that policy signing
64 // keys are valid.
65 POLICY_EXPORT std::string GetPolicyVerificationKey();
66 POLICY_EXPORT extern const char kPolicyVerificationKeyHash[];
68 // TODO(peletskyi): Remove this enum after affiliation code is moved
69 // to components/user_manager.
70 // Describes the affiliation of a user w.r.t. the device owner.
71 enum UserAffiliation {
72 // User is on the same domain the device was registered with.
73 USER_AFFILIATION_MANAGED,
74 // No affiliation between device and user.
75 USER_AFFILIATION_NONE,
78 // Status codes for communication errors with the device management service.
79 // This enum is used to define the buckets for an enumerated UMA histogram.
80 // Hence,
81 // (a) existing enumerated constants should never be deleted or reordered, and
82 // (b) new constants should only be appended at the end of the enumeration.
83 enum DeviceManagementStatus {
84 // All is good.
85 DM_STATUS_SUCCESS = 0,
86 // Request payload invalid.
87 DM_STATUS_REQUEST_INVALID = 1,
88 // The HTTP request failed.
89 DM_STATUS_REQUEST_FAILED = 2,
90 // The server returned an error code that points to a temporary problem.
91 DM_STATUS_TEMPORARY_UNAVAILABLE = 3,
92 // The HTTP request returned a non-success code.
93 DM_STATUS_HTTP_STATUS_ERROR = 4,
94 // Response could not be decoded.
95 DM_STATUS_RESPONSE_DECODING_ERROR = 5,
96 // Service error: Management not supported.
97 DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED = 6,
98 // Service error: Device not found.
99 DM_STATUS_SERVICE_DEVICE_NOT_FOUND = 7,
100 // Service error: Device token invalid.
101 DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID = 8,
102 // Service error: Activation pending.
103 DM_STATUS_SERVICE_ACTIVATION_PENDING = 9,
104 // Service error: The serial number is not valid or not known to the server.
105 DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER = 10,
106 // Service error: The device id used for registration is already taken.
107 DM_STATUS_SERVICE_DEVICE_ID_CONFLICT = 11,
108 // Service error: The licenses have expired or have been exhausted.
109 DM_STATUS_SERVICE_MISSING_LICENSES = 12,
110 // Service error: The administrator has deprovisioned this client.
111 DM_STATUS_SERVICE_DEPROVISIONED = 13,
112 // Service error: Device registration for the wrong domain.
113 DM_STATUS_SERVICE_DOMAIN_MISMATCH = 14,
114 // Service error: Policy not found. Error code defined by the DM folks.
115 DM_STATUS_SERVICE_POLICY_NOT_FOUND = 902,
118 // List of modes that the device can be locked into.
119 enum DeviceMode {
120 DEVICE_MODE_PENDING, // The device mode is not yet available.
121 DEVICE_MODE_NOT_SET, // The device is not yet enrolled or owned.
122 DEVICE_MODE_CONSUMER, // The device is locally owned as consumer
123 // device.
124 DEVICE_MODE_ENTERPRISE, // The device is enrolled as an enterprise
125 // device.
126 DEVICE_MODE_LEGACY_RETAIL_MODE, // The device is enrolled as a retail kiosk
127 // device. Even though retail mode is
128 // deprecated, we still check for this device
129 // mode so that if an existing device is
130 // still enrolled in retail mode, we take the
131 // appropriate action (currently, launching
132 // offline demo mode).
133 DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, // The device is locally owned as
134 // consumer kiosk with ability to auto
135 // launch a kiosk webapp.
138 // An enum that indicates if a device that has a local owner, is enterprise-
139 // managed, or is consumer-managed. This is a copy of ManagementMode in
140 // PolicyData. See device_management_backend.proto for the explanation of each
141 // mode.
142 enum ManagementMode {
143 MANAGEMENT_MODE_LOCAL_OWNER = 0,
144 MANAGEMENT_MODE_ENTERPRISE_MANAGED = 1,
145 MANAGEMENT_MODE_CONSUMER_MANAGED = 2,
148 // Sets management mode field in the |policy_data|.
149 POLICY_EXPORT void SetManagementMode(
150 enterprise_management::PolicyData& policy_data,
151 ManagementMode mode);
153 // Returns the management mode of |policy_data|. You should use this function
154 // instead of using |management_mode| in |policy_data| to handle legacy
155 // |policy_data| that doesn't have |management_mode| set.
156 POLICY_EXPORT ManagementMode GetManagementMode(
157 const enterprise_management::PolicyData& policy_data);
159 } // namespace policy
161 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_