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 enum DeviceManagementStatus { 73 // All is good. 74 DM_STATUS_SUCCESS, 75 // Request payload invalid. 76 DM_STATUS_REQUEST_INVALID, 77 // The HTTP request failed. 78 DM_STATUS_REQUEST_FAILED, 79 // The server returned an error code that points to a temporary problem. 80 DM_STATUS_TEMPORARY_UNAVAILABLE, 81 // The HTTP request returned a non-success code. 82 DM_STATUS_HTTP_STATUS_ERROR, 83 // Response could not be decoded. 84 DM_STATUS_RESPONSE_DECODING_ERROR, 85 // Service error: Management not supported. 86 DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED, 87 // Service error: Device not found. 88 DM_STATUS_SERVICE_DEVICE_NOT_FOUND, 89 // Service error: Device token invalid. 90 DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID, 91 // Service error: Activation pending. 92 DM_STATUS_SERVICE_ACTIVATION_PENDING, 93 // Service error: The serial number is not valid or not known to the server. 94 DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER, 95 // Service error: The device id used for registration is already taken. 96 DM_STATUS_SERVICE_DEVICE_ID_CONFLICT, 97 // Service error: The licenses have expired or have been exhausted. 98 DM_STATUS_SERVICE_MISSING_LICENSES, 99 // Service error: The administrator has deprovisioned this client. 100 DM_STATUS_SERVICE_DEPROVISIONED, 101 // Service error: Device registration for the wrong domain. 102 DM_STATUS_SERVICE_DOMAIN_MISMATCH, 103 // Service error: Policy not found. Error code defined by the DM folks. 104 DM_STATUS_SERVICE_POLICY_NOT_FOUND = 902, 105 }; 106 107 // List of modes that the device can be locked into. 108 enum DeviceMode { 109 DEVICE_MODE_PENDING, // The device mode is not yet available. 110 DEVICE_MODE_NOT_SET, // The device is not yet enrolled or owned. 111 DEVICE_MODE_CONSUMER, // The device is locally owned as consumer 112 // device. 113 DEVICE_MODE_ENTERPRISE, // The device is enrolled as an enterprise 114 // device. 115 DEVICE_MODE_RETAIL_KIOSK, // The device is enrolled as retail kiosk device. 116 DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, // The device is locally owned as 117 // consumer kiosk with ability to auto 118 // launch a kiosk webapp. 119 }; 120 121 // A pair that combines a policy fetch type and entity ID. 122 typedef std::pair<std::string, std::string> PolicyNamespaceKey; 123 124 // Returns the Chrome user policy type to use. This allows overridding the 125 // default user policy type on Android and iOS for testing purposes. 126 // TODO(joaodasilva): remove this once the server is ready. 127 // http://crbug.com/248527 128 POLICY_EXPORT const char* GetChromeUserPolicyType(); 129 130 } // namespace policy 131 132 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_ 133