Chromium Code Reviews| 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. | |
| 39 STATUS_COUNT = 14, // Not a status code. | |
|
pastarmovj
2014/10/30 14:08:50
Thinking more about this - it might not compile be
Thiemo Nagel
2014/10/30 14:24:51
Spot on. I hadn't even tried compiling. :(
| |
| 35 }; | 40 }; |
| 36 | 41 |
| 37 // Helpers for constructing errors for relevant cases. | 42 // Helpers for constructing errors for relevant cases. |
| 38 static EnrollmentStatus ForStatus(Status status); | 43 static EnrollmentStatus ForStatus(Status status); |
| 39 static EnrollmentStatus ForRegistrationError( | 44 static EnrollmentStatus ForRegistrationError( |
| 40 DeviceManagementStatus client_status); | 45 DeviceManagementStatus client_status); |
| 41 static EnrollmentStatus ForFetchError(DeviceManagementStatus client_status); | 46 static EnrollmentStatus ForFetchError(DeviceManagementStatus client_status); |
| 42 static EnrollmentStatus ForRobotAuthFetchError( | 47 static EnrollmentStatus ForRobotAuthFetchError( |
| 43 DeviceManagementStatus client_status); | 48 DeviceManagementStatus client_status); |
| 44 static EnrollmentStatus ForRobotRefreshFetchError(int http_status); | 49 static EnrollmentStatus ForRobotRefreshFetchError(int http_status); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 66 Status status_; | 71 Status status_; |
| 67 DeviceManagementStatus client_status_; | 72 DeviceManagementStatus client_status_; |
| 68 int http_status_; | 73 int http_status_; |
| 69 CloudPolicyStore::Status store_status_; | 74 CloudPolicyStore::Status store_status_; |
| 70 CloudPolicyValidatorBase::Status validation_status_; | 75 CloudPolicyValidatorBase::Status validation_status_; |
| 71 }; | 76 }; |
| 72 | 77 |
| 73 } // namespace policy | 78 } // namespace policy |
| 74 | 79 |
| 75 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ | 80 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_ |
| OLD | NEW |