Don't preload rarely seen large images
[chromium-blink-merge.git] / components / policy / core / common / cloud / cloud_policy_constants.h
blob0b5b8996901068a6912dfc6d877340c58f8db906
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[];
29 POLICY_EXPORT extern const char kParamUserAffiliation[];
31 // String extern constants for the device and app type we report to the server.
32 POLICY_EXPORT extern const char kValueAppType[];
33 POLICY_EXPORT extern const char kValueDeviceType[];
34 POLICY_EXPORT extern const char kValueRequestAutoEnrollment[];
35 POLICY_EXPORT extern const char kValueRequestPolicy[];
36 POLICY_EXPORT extern const char kValueRequestRegister[];
37 POLICY_EXPORT extern const char kValueRequestApiAuthorization[];
38 POLICY_EXPORT extern const char kValueRequestUnregister[];
39 POLICY_EXPORT extern const char kValueRequestUploadCertificate[];
40 POLICY_EXPORT extern const char kValueRequestDeviceStateRetrieval[];
41 POLICY_EXPORT extern const char kValueRequestUploadStatus[];
42 POLICY_EXPORT extern const char kValueRequestRemoteCommands[];
43 POLICY_EXPORT extern const char kValueUserAffiliationManaged[];
44 POLICY_EXPORT extern const char kValueUserAffiliationNone[];
45 POLICY_EXPORT extern const char kValueRequestDeviceAttributeUpdatePermission[];
46 POLICY_EXPORT extern const char kValueRequestDeviceAttributeUpdate[];
48 // Policy type strings for the policy_type field in PolicyFetchRequest.
49 POLICY_EXPORT extern const char kChromeDevicePolicyType[];
50 POLICY_EXPORT extern const char kChromeUserPolicyType[];
51 POLICY_EXPORT extern const char kChromePublicAccountPolicyType[];
52 POLICY_EXPORT extern const char kChromeExtensionPolicyType[];
54 // These codes are sent in the |error_code| field of PolicyFetchResponse.
55 enum PolicyFetchStatus {
56 POLICY_FETCH_SUCCESS = 200,
57 POLICY_FETCH_ERROR_NOT_FOUND = 902,
60 } // namespace dm_protocol
62 // The header used to transmit the policy ID for this client.
63 POLICY_EXPORT extern const char kChromePolicyHeader[];
65 // Information about the verification key used to verify that policy signing
66 // keys are valid.
67 POLICY_EXPORT std::string GetPolicyVerificationKey();
68 POLICY_EXPORT extern const char kPolicyVerificationKeyHash[];
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 // Returns the Chrome user policy type to use. This allows overridding the
139 // default user policy type on Android and iOS for testing purposes.
140 // TODO(joaodasilva): remove this once the server is ready.
141 // http://crbug.com/248527
142 POLICY_EXPORT const char* GetChromeUserPolicyType();
144 // An enum that indicates if a device that has a local owner, is enterprise-
145 // managed, or is consumer-managed. This is a copy of ManagementMode in
146 // PolicyData. See device_management_backend.proto for the explanation of each
147 // mode.
148 enum ManagementMode {
149 MANAGEMENT_MODE_LOCAL_OWNER = 0,
150 MANAGEMENT_MODE_ENTERPRISE_MANAGED = 1,
151 MANAGEMENT_MODE_CONSUMER_MANAGED = 2,
154 // Sets management mode field in the |policy_data|.
155 POLICY_EXPORT void SetManagementMode(
156 enterprise_management::PolicyData& policy_data,
157 ManagementMode mode);
159 // Returns the management mode of |policy_data|. You should use this function
160 // instead of using |management_mode| in |policy_data| to handle legacy
161 // |policy_data| that doesn't have |management_mode| set.
162 POLICY_EXPORT ManagementMode GetManagementMode(
163 const enterprise_management::PolicyData& policy_data);
165 } // namespace policy
167 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_CLOUD_POLICY_CONSTANTS_H_