Update broken references to image assets
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / enrollment_status_chromeos.h
blob2ca67e5f16e9aa1cce85abfd5dbbaf2a1272f4f1
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 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_
8 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
9 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
10 #include "components/policy/core/common/cloud/cloud_policy_store.h"
11 #include "components/policy/core/common/cloud/cloud_policy_validator.h"
13 namespace policy {
15 // Describes the result of an enrollment operation, including the relevant error
16 // codes received from the involved components. Note that the component error
17 // codes only convey useful information in case |status_| points towards a
18 // problem in that specific component.
19 class EnrollmentStatus {
20 public:
21 // Enrollment status codes. Do not change the numeric ids or the meaning of
22 // the existing codes to preserve the interpretability of old logfiles.
23 enum Status {
24 STATUS_SUCCESS = 0, // Enrollment succeeded.
25 STATUS_NO_STATE_KEYS = 1, // Server-backed state keys
26 // unavailable.
27 STATUS_REGISTRATION_FAILED = 2, // DM registration failed.
28 STATUS_REGISTRATION_BAD_MODE = 3, // Bad device mode.
29 STATUS_ROBOT_AUTH_FETCH_FAILED = 4, // API OAuth2 auth code failure.
30 STATUS_ROBOT_REFRESH_FETCH_FAILED = 5, // API OAuth2 refresh token failure.
31 STATUS_ROBOT_REFRESH_STORE_FAILED = 6, // Failed to store API OAuth2 token.
32 STATUS_POLICY_FETCH_FAILED = 7, // DM policy fetch failed.
33 STATUS_VALIDATION_FAILED = 8, // Policy validation failed.
34 STATUS_LOCK_ERROR = 9, // Cryptohome failed to lock device.
35 /* STATUS_LOCK_TIMEOUT = 10, */ // Unused: Timeout while waiting for
36 // the lock.
37 /* STATUS_LOCK_WRONG_USER = 11, */ // Unused: Locked to different
38 // domain.
39 STATUS_STORE_ERROR = 12, // Failed to store the policy.
40 STATUS_STORE_TOKEN_AND_ID_FAILED = 13, // Failed to store DM token and
41 // device ID.
42 STATUS_ATTRIBUTE_UPDATE_FAILED = 14, // Device attribute update failed.
45 // Helpers for constructing errors for relevant cases.
46 static EnrollmentStatus ForStatus(Status status);
47 static EnrollmentStatus ForRegistrationError(
48 DeviceManagementStatus client_status);
49 static EnrollmentStatus ForFetchError(DeviceManagementStatus client_status);
50 static EnrollmentStatus ForRobotAuthFetchError(
51 DeviceManagementStatus client_status);
52 static EnrollmentStatus ForRobotRefreshFetchError(int http_status);
53 static EnrollmentStatus ForValidationError(
54 CloudPolicyValidatorBase::Status validation_status);
55 static EnrollmentStatus ForStoreError(
56 CloudPolicyStore::Status store_error,
57 CloudPolicyValidatorBase::Status validation_status);
58 static EnrollmentStatus ForLockError(
59 EnterpriseInstallAttributes::LockResult lock_status);
61 Status status() const { return status_; }
62 DeviceManagementStatus client_status() const { return client_status_; }
63 int http_status() const { return http_status_; }
64 CloudPolicyStore::Status store_status() const { return store_status_; }
65 CloudPolicyValidatorBase::Status validation_status() const {
66 return validation_status_;
68 EnterpriseInstallAttributes::LockResult lock_status() const {
69 return lock_status_;
72 private:
73 EnrollmentStatus(Status status,
74 DeviceManagementStatus client_status,
75 int http_status,
76 CloudPolicyStore::Status store_status,
77 CloudPolicyValidatorBase::Status validation_status,
78 EnterpriseInstallAttributes::LockResult lock_status);
80 Status status_;
81 DeviceManagementStatus client_status_;
82 int http_status_;
83 CloudPolicyStore::Status store_status_;
84 CloudPolicyValidatorBase::Status validation_status_;
85 EnterpriseInstallAttributes::LockResult lock_status_;
88 } // namespace policy
90 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_STATUS_CHROMEOS_H_