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 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h"
7 #include "net/http/http_status_code.h"
12 EnrollmentStatus EnrollmentStatus::ForStatus(Status status) {
13 return EnrollmentStatus(status, DM_STATUS_SUCCESS, net::HTTP_OK,
14 CloudPolicyStore::STATUS_OK,
15 CloudPolicyValidatorBase::VALIDATION_OK,
16 EnterpriseInstallAttributes::LOCK_SUCCESS);
20 EnrollmentStatus EnrollmentStatus::ForRegistrationError(
21 DeviceManagementStatus client_status) {
22 return EnrollmentStatus(STATUS_REGISTRATION_FAILED, client_status,
23 net::HTTP_OK, CloudPolicyStore::STATUS_OK,
24 CloudPolicyValidatorBase::VALIDATION_OK,
25 EnterpriseInstallAttributes::LOCK_SUCCESS);
29 EnrollmentStatus EnrollmentStatus::ForRobotAuthFetchError(
30 DeviceManagementStatus client_status) {
31 return EnrollmentStatus(STATUS_ROBOT_AUTH_FETCH_FAILED, client_status,
32 net::HTTP_OK, CloudPolicyStore::STATUS_OK,
33 CloudPolicyValidatorBase::VALIDATION_OK,
34 EnterpriseInstallAttributes::LOCK_SUCCESS);
38 EnrollmentStatus EnrollmentStatus::ForRobotRefreshFetchError(int http_status) {
39 return EnrollmentStatus(STATUS_ROBOT_REFRESH_FETCH_FAILED, DM_STATUS_SUCCESS,
40 http_status, CloudPolicyStore::STATUS_OK,
41 CloudPolicyValidatorBase::VALIDATION_OK,
42 EnterpriseInstallAttributes::LOCK_SUCCESS);
46 EnrollmentStatus EnrollmentStatus::ForFetchError(
47 DeviceManagementStatus client_status) {
48 return EnrollmentStatus(STATUS_POLICY_FETCH_FAILED, client_status,
49 net::HTTP_OK, CloudPolicyStore::STATUS_OK,
50 CloudPolicyValidatorBase::VALIDATION_OK,
51 EnterpriseInstallAttributes::LOCK_SUCCESS);
55 EnrollmentStatus EnrollmentStatus::ForValidationError(
56 CloudPolicyValidatorBase::Status validation_status) {
57 return EnrollmentStatus(STATUS_VALIDATION_FAILED, DM_STATUS_SUCCESS,
58 net::HTTP_OK, CloudPolicyStore::STATUS_OK,
60 EnterpriseInstallAttributes::LOCK_SUCCESS);
64 EnrollmentStatus EnrollmentStatus::ForStoreError(
65 CloudPolicyStore::Status store_error,
66 CloudPolicyValidatorBase::Status validation_status) {
67 return EnrollmentStatus(STATUS_STORE_ERROR, DM_STATUS_SUCCESS,
68 net::HTTP_OK, store_error, validation_status,
69 EnterpriseInstallAttributes::LOCK_SUCCESS);
73 EnrollmentStatus EnrollmentStatus::ForLockError(
74 EnterpriseInstallAttributes::LockResult lock_status) {
75 return EnrollmentStatus(STATUS_LOCK_ERROR, DM_STATUS_SUCCESS,
76 net::HTTP_OK, CloudPolicyStore::STATUS_OK,
77 CloudPolicyValidatorBase::VALIDATION_OK,
81 EnrollmentStatus::EnrollmentStatus(
82 EnrollmentStatus::Status status,
83 DeviceManagementStatus client_status,
85 CloudPolicyStore::Status store_status,
86 CloudPolicyValidatorBase::Status validation_status,
87 EnterpriseInstallAttributes::LockResult lock_status)
89 client_status_(client_status),
90 http_status_(http_status),
91 store_status_(store_status),
92 validation_status_(validation_status),
93 lock_status_(lock_status) {}