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 "chrome/browser/policy/cloud/cloud_policy_constants.h" | 8 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
9 #include "chrome/browser/policy/cloud/cloud_policy_store.h" | 9 #include "chrome/browser/policy/cloud/cloud_policy_store.h" |
10 #include "chrome/browser/policy/cloud/cloud_policy_validator.h" | 10 #include "chrome/browser/policy/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. |
19 enum Status { | 19 enum Status { |
20 STATUS_SUCCESS, // Enrollment succeeded. | 20 STATUS_SUCCESS, // Enrollment succeeded. |
21 STATUS_REGISTRATION_FAILED, // DM registration failed. | 21 STATUS_REGISTRATION_FAILED, // DM registration failed. |
22 STATUS_REGISTRATION_BAD_MODE, // Bad device mode. | 22 STATUS_REGISTRATION_BAD_MODE, // Bad device mode. |
23 STATUS_POLICY_FETCH_FAILED, // DM policy fetch failed. | 23 STATUS_ROBOT_AUTH_FETCH_FAILED, // API OAuth2 auth code failure. |
24 STATUS_VALIDATION_FAILED, // Policy validation failed. | 24 STATUS_ROBOT_REFRESH_FETCH_FAILED, // API OAuth2 refresh token failure. |
25 STATUS_LOCK_ERROR, // Cryptohome failed to lock the device. | 25 STATUS_POLICY_FETCH_FAILED, // DM policy fetch failed. |
26 STATUS_LOCK_TIMEOUT, // Timeout while waiting for the lock. | 26 STATUS_VALIDATION_FAILED, // Policy validation failed. |
27 STATUS_LOCK_WRONG_USER, // Locked to different domain. | 27 STATUS_LOCK_ERROR, // Cryptohome failed to lock the device. |
28 STATUS_STORE_ERROR, // Failed to store the policy. | 28 STATUS_LOCK_TIMEOUT, // Timeout while waiting for the lock. |
| 29 STATUS_LOCK_WRONG_USER, // Locked to different domain. |
| 30 STATUS_STORE_ERROR, // Failed to store the policy. |
29 }; | 31 }; |
30 | 32 |
31 // Helpers for constructing errors for relevant cases. | 33 // Helpers for constructing errors for relevant cases. |
32 static EnrollmentStatus ForStatus(Status status); | 34 static EnrollmentStatus ForStatus(Status status); |
33 static EnrollmentStatus ForRegistrationError( | 35 static EnrollmentStatus ForRegistrationError( |
34 DeviceManagementStatus client_status); | 36 DeviceManagementStatus client_status); |
35 static EnrollmentStatus ForFetchError(DeviceManagementStatus client_status); | 37 static EnrollmentStatus ForFetchError(DeviceManagementStatus client_status); |
| 38 static EnrollmentStatus ForRobotAuthError( |
| 39 DeviceManagementStatus client_status); |
36 static EnrollmentStatus ForValidationError( | 40 static EnrollmentStatus ForValidationError( |
37 CloudPolicyValidatorBase::Status validation_status); | 41 CloudPolicyValidatorBase::Status validation_status); |
38 static EnrollmentStatus ForStoreError( | 42 static EnrollmentStatus ForStoreError( |
39 CloudPolicyStore::Status store_error, | 43 CloudPolicyStore::Status store_error, |
40 CloudPolicyValidatorBase::Status validation_status); | 44 CloudPolicyValidatorBase::Status validation_status); |
41 | 45 |
42 Status status() const { return status_; } | 46 Status status() const { return status_; } |
43 DeviceManagementStatus client_status() const { return client_status_; } | 47 DeviceManagementStatus client_status() const { return client_status_; } |
44 CloudPolicyStore::Status store_status() const { return store_status_; } | 48 CloudPolicyStore::Status store_status() const { return store_status_; } |
45 CloudPolicyValidatorBase::Status validation_status() const { | 49 CloudPolicyValidatorBase::Status validation_status() const { |
46 return validation_status_; | 50 return validation_status_; |
47 } | 51 } |
48 | 52 |
49 private: | 53 private: |
50 EnrollmentStatus(Status status, | 54 EnrollmentStatus(Status status, |
51 DeviceManagementStatus client_status, | 55 DeviceManagementStatus client_status, |
52 CloudPolicyStore::Status store_status, | 56 CloudPolicyStore::Status store_status, |
53 CloudPolicyValidatorBase::Status validation_status); | 57 CloudPolicyValidatorBase::Status validation_status); |
54 | 58 |
55 Status status_; | 59 Status status_; |
56 DeviceManagementStatus client_status_; | 60 DeviceManagementStatus client_status_; |
57 CloudPolicyStore::Status store_status_; | 61 CloudPolicyStore::Status store_status_; |
58 CloudPolicyValidatorBase::Status validation_status_; | 62 CloudPolicyValidatorBase::Status validation_status_; |
59 }; | 63 }; |
60 | 64 |
61 } // namespace policy | 65 } // namespace policy |
62 | 66 |
63 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ | 67 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ |
OLD | NEW |