• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_
7 
8 #include <string>
9 #include <utility>
10 
11 #include "components/policy/policy_export.h"
12 
13 namespace policy {
14 
15 // Constants related to the device management protocol.
16 namespace dm_protocol {
17 
18 // Name extern constants for URL query parameters.
19 POLICY_EXPORT extern const char kParamAgent[];
20 POLICY_EXPORT extern const char kParamAppType[];
21 POLICY_EXPORT extern const char kParamDeviceID[];
22 POLICY_EXPORT extern const char kParamDeviceType[];
23 POLICY_EXPORT extern const char kParamOAuthToken[];
24 POLICY_EXPORT extern const char kParamPlatform[];
25 POLICY_EXPORT extern const char kParamRequest[];
26 POLICY_EXPORT extern const char kParamUserAffiliation[];
27 
28 // String extern constants for the device and app type we report to the server.
29 POLICY_EXPORT extern const char kValueAppType[];
30 POLICY_EXPORT extern const char kValueDeviceType[];
31 POLICY_EXPORT extern const char kValueRequestAutoEnrollment[];
32 POLICY_EXPORT extern const char kValueRequestPolicy[];
33 POLICY_EXPORT extern const char kValueRequestRegister[];
34 POLICY_EXPORT extern const char kValueRequestApiAuthorization[];
35 POLICY_EXPORT extern const char kValueRequestUnregister[];
36 POLICY_EXPORT extern const char kValueRequestUploadCertificate[];
37 POLICY_EXPORT extern const char kValueUserAffiliationManaged[];
38 POLICY_EXPORT extern const char kValueUserAffiliationNone[];
39 
40 // Policy type strings for the policy_type field in PolicyFetchRequest.
41 POLICY_EXPORT extern const char kChromeDevicePolicyType[];
42 POLICY_EXPORT extern const char kChromeUserPolicyType[];
43 POLICY_EXPORT extern const char kChromePublicAccountPolicyType[];
44 POLICY_EXPORT extern const char kChromeExtensionPolicyType[];
45 
46 // These codes are sent in the |error_code| field of PolicyFetchResponse.
47 enum PolicyFetchStatus {
48   POLICY_FETCH_SUCCESS = 200,
49   POLICY_FETCH_ERROR_NOT_FOUND = 902,
50 };
51 
52 }  // namespace dm_protocol
53 
54 // Describes the affiliation of a user w.r.t. the device owner.
55 enum UserAffiliation {
56   // User is on the same domain the device was registered with.
57   USER_AFFILIATION_MANAGED,
58   // No affiliation between device and user.
59   USER_AFFILIATION_NONE,
60 };
61 
62 // Status codes for communication errors with the device management service.
63 enum DeviceManagementStatus {
64   // All is good.
65   DM_STATUS_SUCCESS,
66   // Request payload invalid.
67   DM_STATUS_REQUEST_INVALID,
68   // The HTTP request failed.
69   DM_STATUS_REQUEST_FAILED,
70   // The server returned an error code that points to a temporary problem.
71   DM_STATUS_TEMPORARY_UNAVAILABLE,
72   // The HTTP request returned a non-success code.
73   DM_STATUS_HTTP_STATUS_ERROR,
74   // Response could not be decoded.
75   DM_STATUS_RESPONSE_DECODING_ERROR,
76   // Service error: Management not supported.
77   DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED,
78   // Service error: Device not found.
79   DM_STATUS_SERVICE_DEVICE_NOT_FOUND,
80   // Service error: Device token invalid.
81   DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID,
82   // Service error: Activation pending.
83   DM_STATUS_SERVICE_ACTIVATION_PENDING,
84   // Service error: The serial number is not valid or not known to the server.
85   DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER,
86   // Service error: The device id used for registration is already taken.
87   DM_STATUS_SERVICE_DEVICE_ID_CONFLICT,
88   // Service error: The licenses have expired or have been exhausted.
89   DM_STATUS_SERVICE_MISSING_LICENSES,
90   // Service error: The administrator has deprovisioned this client.
91   DM_STATUS_SERVICE_DEPROVISIONED,
92   // Service error: Policy not found. Error code defined by the DM folks.
93   DM_STATUS_SERVICE_POLICY_NOT_FOUND = 902,
94 };
95 
96 // List of modes that the device can be locked into.
97 enum DeviceMode {
98   DEVICE_MODE_PENDING,         // The device mode is not yet available.
99   DEVICE_MODE_NOT_SET,         // The device is not yet enrolled or owned.
100   DEVICE_MODE_CONSUMER,        // The device is locally owned as consumer
101                                // device.
102   DEVICE_MODE_ENTERPRISE,      // The device is enrolled as an enterprise
103                                // device.
104   DEVICE_MODE_RETAIL_KIOSK,    // The device is enrolled as retail kiosk device.
105   DEVICE_MODE_CONSUMER_KIOSK,  // The device is locally owned as consumer kiosk.
106 };
107 
108 // A pair that combines a policy fetch type and entity ID.
109 typedef std::pair<std::string, std::string> PolicyNamespaceKey;
110 
111 // Returns the Chrome user policy type to use. This allows overridding the
112 // default user policy type on Android and iOS for testing purposes.
113 // TODO(joaodasilva): remove this once the server is ready.
114 // http://crbug.com/248527
115 POLICY_EXPORT const char* GetChromeUserPolicyType();
116 
117 }  // namespace policy
118 
119 #endif  // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_
120