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 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
      6 
      7 #include "base/command_line.h"
      8 #include "components/policy/core/common/policy_switches.h"
      9 
     10 namespace policy {
     11 
     12 // Constants related to the device management protocol.
     13 namespace dm_protocol {
     14 
     15 // Name constants for URL query parameters.
     16 const char kParamAgent[] = "agent";
     17 const char kParamAppType[] = "apptype";
     18 const char kParamDeviceID[] = "deviceid";
     19 const char kParamDeviceType[] = "devicetype";
     20 const char kParamOAuthToken[] = "oauth_token";
     21 const char kParamPlatform[] = "platform";
     22 const char kParamRequest[] = "request";
     23 const char kParamUserAffiliation[] = "user_affiliation";
     24 
     25 // String constants for the device and app type we report to the server.
     26 const char kValueAppType[] = "Chrome";
     27 const char kValueDeviceType[] = "2";
     28 const char kValueRequestAutoEnrollment[] = "enterprise_check";
     29 const char kValueRequestPolicy[] = "policy";
     30 const char kValueRequestRegister[] = "register";
     31 const char kValueRequestApiAuthorization[] = "api_authorization";
     32 const char kValueRequestUnregister[] = "unregister";
     33 const char kValueRequestUploadCertificate[] = "cert_upload";
     34 const char kValueUserAffiliationManaged[] = "managed";
     35 const char kValueUserAffiliationNone[] = "none";
     36 
     37 const char kChromeDevicePolicyType[] = "google/chromeos/device";
     38 #if defined(OS_CHROMEOS)
     39 const char kChromeUserPolicyType[] = "google/chromeos/user";
     40 #elif defined(OS_ANDROID)
     41 const char kChromeUserPolicyType[] = "google/android/user";
     42 #elif defined(OS_IOS)
     43 const char kChromeUserPolicyType[] = "google/ios/user";
     44 #else
     45 const char kChromeUserPolicyType[] = "google/chrome/user";
     46 #endif
     47 const char kChromePublicAccountPolicyType[] = "google/chromeos/publicaccount";
     48 const char kChromeExtensionPolicyType[] = "google/chrome/extension";
     49 
     50 }  // namespace dm_protocol
     51 
     52 const char* GetChromeUserPolicyType() {
     53 #if defined(OS_ANDROID) || defined(OS_IOS)
     54   CommandLine* command_line = CommandLine::ForCurrentProcess();
     55   if (command_line->HasSwitch(switches::kFakeCloudPolicyType))
     56     return "google/chrome/user";
     57 #endif
     58   return dm_protocol::kChromeUserPolicyType;
     59 }
     60 
     61 }  // namespace policy
     62