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
);
19 EnrollmentStatus
EnrollmentStatus::ForRegistrationError(
20 DeviceManagementStatus client_status
) {
21 return EnrollmentStatus(STATUS_REGISTRATION_FAILED
, client_status
,
22 net::HTTP_OK
, CloudPolicyStore::STATUS_OK
,
23 CloudPolicyValidatorBase::VALIDATION_OK
);
27 EnrollmentStatus
EnrollmentStatus::ForRobotAuthFetchError(
28 DeviceManagementStatus client_status
) {
29 return EnrollmentStatus(STATUS_ROBOT_AUTH_FETCH_FAILED
, client_status
,
30 net::HTTP_OK
, CloudPolicyStore::STATUS_OK
,
31 CloudPolicyValidatorBase::VALIDATION_OK
);
35 EnrollmentStatus
EnrollmentStatus::ForRobotRefreshFetchError(int http_status
) {
36 return EnrollmentStatus(STATUS_ROBOT_REFRESH_FETCH_FAILED
, DM_STATUS_SUCCESS
,
37 http_status
, CloudPolicyStore::STATUS_OK
,
38 CloudPolicyValidatorBase::VALIDATION_OK
);
42 EnrollmentStatus
EnrollmentStatus::ForFetchError(
43 DeviceManagementStatus client_status
) {
44 return EnrollmentStatus(STATUS_POLICY_FETCH_FAILED
, client_status
,
45 net::HTTP_OK
, CloudPolicyStore::STATUS_OK
,
46 CloudPolicyValidatorBase::VALIDATION_OK
);
50 EnrollmentStatus
EnrollmentStatus::ForValidationError(
51 CloudPolicyValidatorBase::Status validation_status
) {
52 return EnrollmentStatus(STATUS_VALIDATION_FAILED
, DM_STATUS_SUCCESS
,
53 net::HTTP_OK
, CloudPolicyStore::STATUS_OK
,
58 EnrollmentStatus
EnrollmentStatus::ForStoreError(
59 CloudPolicyStore::Status store_error
,
60 CloudPolicyValidatorBase::Status validation_status
) {
61 return EnrollmentStatus(STATUS_STORE_ERROR
, DM_STATUS_SUCCESS
,
62 net::HTTP_OK
, store_error
, validation_status
);
65 EnrollmentStatus::EnrollmentStatus(
66 EnrollmentStatus::Status status
,
67 DeviceManagementStatus client_status
,
69 CloudPolicyStore::Status store_status
,
70 CloudPolicyValidatorBase::Status validation_status
)
72 client_status_(client_status
),
73 http_status_(http_status
),
74 store_status_(store_status
),
75 validation_status_(validation_status
) {}