Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / policy / enrollment_status_chromeos.cc
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 "chrome/browser/chromeos/policy/enrollment_status_chromeos.h"
6
7 #include "net/http/http_status_code.h"
8
9 namespace policy {
10
11 // static
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);
17 }
18
19 // static
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);
26 }
27
28 // static
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);
35 }
36
37 // static
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);
43 }
44
45 // static
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);
52 }
53
54 // static
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,
59                           validation_status,
60                           EnterpriseInstallAttributes::LOCK_SUCCESS);
61 }
62
63 // static
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);
70 }
71
72 // static
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,
78                           lock_status);
79 }
80
81 EnrollmentStatus::EnrollmentStatus(
82     EnrollmentStatus::Status status,
83     DeviceManagementStatus client_status,
84     int http_status,
85     CloudPolicyStore::Status store_status,
86     CloudPolicyValidatorBase::Status validation_status,
87     EnterpriseInstallAttributes::LockResult lock_status)
88     : status_(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) {}
94
95 }  // namespace policy