• 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 kValueRequestDeviceStateRetrieval[];
38 POLICY_EXPORT extern const char kValueUserAffiliationManaged[];
39 POLICY_EXPORT extern const char kValueUserAffiliationNone[];
40 
41 // Policy type strings for the policy_type field in PolicyFetchRequest.
42 POLICY_EXPORT extern const char kChromeDevicePolicyType[];
43 POLICY_EXPORT extern const char kChromeUserPolicyType[];
44 POLICY_EXPORT extern const char kChromePublicAccountPolicyType[];
45 POLICY_EXPORT extern const char kChromeExtensionPolicyType[];
46 
47 // These codes are sent in the |error_code| field of PolicyFetchResponse.
48 enum PolicyFetchStatus {
49   POLICY_FETCH_SUCCESS = 200,
50   POLICY_FETCH_ERROR_NOT_FOUND = 902,
51 };
52 
53 }  // namespace dm_protocol
54 
55 // The header used to transmit the policy ID for this client.
56 POLICY_EXPORT extern const char kChromePolicyHeader[];
57 
58 // Information about the verification key used to verify that policy signing
59 // keys are valid.
60 POLICY_EXPORT std::string GetPolicyVerificationKey();
61 POLICY_EXPORT extern const char kPolicyVerificationKeyHash[];
62 
63 // Describes the affiliation of a user w.r.t. the device owner.
64 enum UserAffiliation {
65   // User is on the same domain the device was registered with.
66   USER_AFFILIATION_MANAGED,
67   // No affiliation between device and user.
68   USER_AFFILIATION_NONE,
69 };
70 
71 // Status codes for communication errors with the device management service.
72 // This enum is used to define the buckets for an enumerated UMA histogram.
73 // Hence,
74 //   (a) existing enumerated constants should never be deleted or reordered, and
75 //   (b) new constants should only be appended at the end of the enumeration.
76 enum DeviceManagementStatus {
77   // All is good.
78   DM_STATUS_SUCCESS = 0,
79   // Request payload invalid.
80   DM_STATUS_REQUEST_INVALID = 1,
81   // The HTTP request failed.
82   DM_STATUS_REQUEST_FAILED = 2,
83   // The server returned an error code that points to a temporary problem.
84   DM_STATUS_TEMPORARY_UNAVAILABLE = 3,
85   // The HTTP request returned a non-success code.
86   DM_STATUS_HTTP_STATUS_ERROR = 4,
87   // Response could not be decoded.
88   DM_STATUS_RESPONSE_DECODING_ERROR = 5,
89   // Service error: Management not supported.
90   DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED = 6,
91   // Service error: Device not found.
92   DM_STATUS_SERVICE_DEVICE_NOT_FOUND = 7,
93   // Service error: Device token invalid.
94   DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID = 8,
95   // Service error: Activation pending.
96   DM_STATUS_SERVICE_ACTIVATION_PENDING = 9,
97   // Service error: The serial number is not valid or not known to the server.
98   DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER = 10,
99   // Service error: The device id used for registration is already taken.
100   DM_STATUS_SERVICE_DEVICE_ID_CONFLICT = 11,
101   // Service error: The licenses have expired or have been exhausted.
102   DM_STATUS_SERVICE_MISSING_LICENSES = 12,
103   // Service error: The administrator has deprovisioned this client.
104   DM_STATUS_SERVICE_DEPROVISIONED = 13,
105   // Service error: Device registration for the wrong domain.
106   DM_STATUS_SERVICE_DOMAIN_MISMATCH = 14,
107   // Service error: Policy not found. Error code defined by the DM folks.
108   DM_STATUS_SERVICE_POLICY_NOT_FOUND = 902,
109 };
110 
111 // List of modes that the device can be locked into.
112 enum DeviceMode {
113   DEVICE_MODE_PENDING,         // The device mode is not yet available.
114   DEVICE_MODE_NOT_SET,         // The device is not yet enrolled or owned.
115   DEVICE_MODE_CONSUMER,        // The device is locally owned as consumer
116                                // device.
117   DEVICE_MODE_ENTERPRISE,      // The device is enrolled as an enterprise
118                                // device.
119   DEVICE_MODE_RETAIL_KIOSK,    // The device is enrolled as retail kiosk device.
120   DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH,  // The device is locally owned as
121                                           // consumer kiosk with ability to auto
122                                           // launch a kiosk webapp.
123 };
124 
125 // A pair that combines a policy fetch type and entity ID.
126 typedef std::pair<std::string, std::string> PolicyNamespaceKey;
127 
128 // Returns the Chrome user policy type to use. This allows overridding the
129 // default user policy type on Android and iOS for testing purposes.
130 // TODO(joaodasilva): remove this once the server is ready.
131 // http://crbug.com/248527
132 POLICY_EXPORT const char* GetChromeUserPolicyType();
133 
134 }  // namespace policy
135 
136 #endif  // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_
137