OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ |
7 | 7 |
8 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 8 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
9 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 9 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
10 #include "components/policy/core/common/cloud/cloud_policy_validator.h" | 10 #include "components/policy/core/common/cloud/cloud_policy_validator.h" |
11 | 11 |
12 namespace policy { | 12 namespace policy { |
13 | 13 |
14 // Describes the result of an enrollment operation, including the relevant error | 14 // Describes the result of an enrollment operation, including the relevant error |
15 // codes received from the involved components. | 15 // codes received from the involved components. |
16 class EnrollmentStatus { | 16 class EnrollmentStatus { |
17 public: | 17 public: |
18 // Enrollment status codes. | 18 // Enrollment status codes. Do not change the order or the meaning of the |
| 19 // existing codes to preserve the interpretability of old logfiles. |
19 enum Status { | 20 enum Status { |
20 STATUS_SUCCESS, // Enrollment succeeded. | 21 STATUS_SUCCESS = 0, // Enrollment succeeded. |
21 STATUS_NO_STATE_KEYS, // Server-backed state keys unavailable. | 22 STATUS_NO_STATE_KEYS = 1, // Server-backed state keys |
22 STATUS_REGISTRATION_FAILED, // DM registration failed. | 23 // unavailable. |
23 STATUS_REGISTRATION_BAD_MODE, // Bad device mode. | 24 STATUS_REGISTRATION_FAILED = 2, // DM registration failed. |
24 STATUS_ROBOT_AUTH_FETCH_FAILED, // API OAuth2 auth code failure. | 25 STATUS_REGISTRATION_BAD_MODE = 3, // Bad device mode. |
25 STATUS_ROBOT_REFRESH_FETCH_FAILED, // API OAuth2 refresh token failure. | 26 STATUS_ROBOT_AUTH_FETCH_FAILED = 4, // API OAuth2 auth code failure. |
26 STATUS_ROBOT_REFRESH_STORE_FAILED, // Failed to store API OAuth2 token. | 27 STATUS_ROBOT_REFRESH_FETCH_FAILED = 5, // API OAuth2 refresh token failure. |
27 STATUS_POLICY_FETCH_FAILED, // DM policy fetch failed. | 28 STATUS_ROBOT_REFRESH_STORE_FAILED = 6, // Failed to store API OAuth2 token. |
28 STATUS_VALIDATION_FAILED, // Policy validation failed. | 29 STATUS_POLICY_FETCH_FAILED = 7, // DM policy fetch failed. |
29 STATUS_LOCK_ERROR, // Cryptohome failed to lock the device. | 30 STATUS_VALIDATION_FAILED = 8, // Policy validation failed. |
30 STATUS_LOCK_TIMEOUT, // Timeout while waiting for the lock. | 31 STATUS_LOCK_ERROR = 9, // Cryptohome failed to lock the |
31 STATUS_LOCK_WRONG_USER, // Locked to different domain. | 32 // device. |
32 STATUS_STORE_ERROR, // Failed to store the policy. | 33 STATUS_LOCK_TIMEOUT = 10, // Timeout while waiting for the |
33 STATUS_STORE_TOKEN_AND_ID_FAILED, // Failed to store DM token and device | 34 // lock. |
34 // ID. | 35 STATUS_LOCK_WRONG_USER = 11, // Locked to different domain. |
| 36 STATUS_STORE_ERROR = 12, // Failed to store the policy. |
| 37 STATUS_STORE_TOKEN_AND_ID_FAILED = 13, // Failed to store DM token and |
| 38 // device ID. |
35 }; | 39 }; |
36 | 40 |
37 // Helpers for constructing errors for relevant cases. | 41 // Helpers for constructing errors for relevant cases. |
38 static EnrollmentStatus ForStatus(Status status); | 42 static EnrollmentStatus ForStatus(Status status); |
39 static EnrollmentStatus ForRegistrationError( | 43 static EnrollmentStatus ForRegistrationError( |
40 DeviceManagementStatus client_status); | 44 DeviceManagementStatus client_status); |
41 static EnrollmentStatus ForFetchError(DeviceManagementStatus client_status); | 45 static EnrollmentStatus ForFetchError(DeviceManagementStatus client_status); |
42 static EnrollmentStatus ForRobotAuthFetchError( | 46 static EnrollmentStatus ForRobotAuthFetchError( |
43 DeviceManagementStatus client_status); | 47 DeviceManagementStatus client_status); |
44 static EnrollmentStatus ForRobotRefreshFetchError(int http_status); | 48 static EnrollmentStatus ForRobotRefreshFetchError(int http_status); |
(...skipping 21 matching lines...) Expand all Loading... |
66 Status status_; | 70 Status status_; |
67 DeviceManagementStatus client_status_; | 71 DeviceManagementStatus client_status_; |
68 int http_status_; | 72 int http_status_; |
69 CloudPolicyStore::Status store_status_; | 73 CloudPolicyStore::Status store_status_; |
70 CloudPolicyValidatorBase::Status validation_status_; | 74 CloudPolicyValidatorBase::Status validation_status_; |
71 }; | 75 }; |
72 | 76 |
73 } // namespace policy | 77 } // namespace policy |
74 | 78 |
75 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ | 79 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ |
OLD | NEW |