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