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 13namespace policy { 14 15// Constants related to the device management protocol. 16namespace dm_protocol { 17 18// Name extern constants for URL query parameters. 19POLICY_EXPORT extern const char kParamAgent[]; 20POLICY_EXPORT extern const char kParamAppType[]; 21POLICY_EXPORT extern const char kParamDeviceID[]; 22POLICY_EXPORT extern const char kParamDeviceType[]; 23POLICY_EXPORT extern const char kParamOAuthToken[]; 24POLICY_EXPORT extern const char kParamPlatform[]; 25POLICY_EXPORT extern const char kParamRequest[]; 26POLICY_EXPORT extern const char kParamUserAffiliation[]; 27 28// String extern constants for the device and app type we report to the server. 29POLICY_EXPORT extern const char kValueAppType[]; 30POLICY_EXPORT extern const char kValueDeviceType[]; 31POLICY_EXPORT extern const char kValueRequestAutoEnrollment[]; 32POLICY_EXPORT extern const char kValueRequestPolicy[]; 33POLICY_EXPORT extern const char kValueRequestRegister[]; 34POLICY_EXPORT extern const char kValueRequestApiAuthorization[]; 35POLICY_EXPORT extern const char kValueRequestUnregister[]; 36POLICY_EXPORT extern const char kValueRequestUploadCertificate[]; 37POLICY_EXPORT extern const char kValueRequestDeviceStateRetrieval[]; 38POLICY_EXPORT extern const char kValueUserAffiliationManaged[]; 39POLICY_EXPORT extern const char kValueUserAffiliationNone[]; 40 41// Policy type strings for the policy_type field in PolicyFetchRequest. 42POLICY_EXPORT extern const char kChromeDevicePolicyType[]; 43POLICY_EXPORT extern const char kChromeUserPolicyType[]; 44POLICY_EXPORT extern const char kChromePublicAccountPolicyType[]; 45POLICY_EXPORT extern const char kChromeExtensionPolicyType[]; 46 47// These codes are sent in the |error_code| field of PolicyFetchResponse. 48enum 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. 56POLICY_EXPORT extern const char kChromePolicyHeader[]; 57 58// Information about the verification key used to verify that policy signing 59// keys are valid. 60POLICY_EXPORT std::string GetPolicyVerificationKey(); 61POLICY_EXPORT extern const char kPolicyVerificationKeyHash[]; 62 63// Describes the affiliation of a user w.r.t. the device owner. 64enum 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. 72enum 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. 108enum 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. 122typedef 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 128POLICY_EXPORT const char* GetChromeUserPolicyType(); 129 130} // namespace policy 131 132#endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_ 133