| 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_HANDLER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 STEP_ROBOT_AUTH_FETCH, // Fetching device API auth code. | 114 STEP_ROBOT_AUTH_FETCH, // Fetching device API auth code. |
| 115 STEP_ROBOT_AUTH_REFRESH, // Fetching device API refresh token. | 115 STEP_ROBOT_AUTH_REFRESH, // Fetching device API refresh token. |
| 116 STEP_LOCK_DEVICE, // Writing installation-time attributes. | 116 STEP_LOCK_DEVICE, // Writing installation-time attributes. |
| 117 STEP_STORE_TOKEN_AND_ID, // Storing DM token and virtual device ID. | 117 STEP_STORE_TOKEN_AND_ID, // Storing DM token and virtual device ID. |
| 118 STEP_STORE_ROBOT_AUTH, // Encrypting & writing robot refresh token. | 118 STEP_STORE_ROBOT_AUTH, // Encrypting & writing robot refresh token. |
| 119 STEP_STORE_POLICY, // Storing policy and API refresh token. | 119 STEP_STORE_POLICY, // Storing policy and API refresh token. |
| 120 STEP_FINISHED, // Enrollment process finished, no further action. | 120 STEP_FINISHED, // Enrollment process finished, no further action. |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 // Handles the response to a request for server-backed state keys. | 123 // Handles the response to a request for server-backed state keys. |
| 124 void HandleStateKeysResult(const std::vector<std::string>& state_keys, | 124 void CheckStateKeys(const std::vector<std::string>& state_keys, |
| 125 bool first_boot); | 125 bool first_boot); |
| 126 | 126 |
| 127 // Starts registration if the store is initialized. | 127 // Starts registration if the store is initialized. |
| 128 void StartRegistration(); | 128 void AttemptRegistration(); |
| 129 | 129 |
| 130 // Handles the policy validation result, proceeding with device lock if | 130 // Handles the policy validation result, proceeding with installation-time |
| 131 // successful. | 131 // attributes locking if successful. |
| 132 void HandlePolicyValidationResult(DeviceCloudPolicyValidator* validator); | 132 void PolicyValidated(DeviceCloudPolicyValidator* validator); |
| 133 | 133 |
| 134 // Calls InstallAttributes::LockDevice() for enterprise enrollment and | 134 // Calls LockDevice() and proceeds to policy installation. If unsuccessful, |
| 135 // DeviceSettingsService::SetManagementSettings() for consumer | 135 // reports the result. Actual installation or error report will be done in |
| 136 // enrollment. | 136 // HandleLockDeviceResult(). |
| 137 void StartLockDevice(); | 137 void StartLockDevice(); |
| 138 | 138 |
| 139 // Checks the status after SetManagementSettings() is done. Proceeds to | 139 // Checks the status after SetManagementSettings() is done. Proceeds to |
| 140 // robot auth code storing if successful. | 140 // robot auth code storing if successful. |
| 141 void HandleSetManagementSettingsDone(); | 141 void OnSetManagementSettingsDone(); |
| 142 | 142 |
| 143 // Handle callback from InstallAttributes::LockDevice() and retry on failure. | 143 // Helper for StartLockDevice(). It performs the actual action based on |
| 144 // the result of LockDevice. |
| 144 void HandleLockDeviceResult( | 145 void HandleLockDeviceResult( |
| 145 EnterpriseInstallAttributes::LockResult lock_result); | 146 EnterpriseInstallAttributes::LockResult lock_result); |
| 146 | 147 |
| 147 // Initiates storing of robot auth token. | 148 // Stores robot auth token. |
| 148 void StartStoreRobotAuth(); | 149 void StoreRobotAuth(); |
| 149 | 150 |
| 150 // Handles completion of the robot token store operation. | 151 // Handles completion of the robot token store operation. |
| 151 void HandleStoreRobotAuthTokenResult(bool result); | 152 void HandleRobotAuthTokenStored(bool result); |
| 152 | 153 |
| 153 // Drops any ongoing actions. | 154 // Drops any ongoing actions. |
| 154 void Stop(); | 155 void Stop(); |
| 155 | 156 |
| 156 // Reports the result of the enrollment process to the initiator. | 157 // Reports the result of the enrollment process to the initiator. |
| 157 void ReportResult(EnrollmentStatus status); | 158 void ReportResult(EnrollmentStatus status); |
| 158 | 159 |
| 159 DeviceCloudPolicyStoreChromeOS* store_; | 160 DeviceCloudPolicyStoreChromeOS* store_; |
| 160 EnterpriseInstallAttributes* install_attributes_; | 161 EnterpriseInstallAttributes* install_attributes_; |
| 161 ServerBackedStateKeysBroker* state_keys_broker_; | 162 ServerBackedStateKeysBroker* state_keys_broker_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 191 int lockbox_init_duration_; | 192 int lockbox_init_duration_; |
| 192 | 193 |
| 193 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 194 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
| 194 | 195 |
| 195 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 196 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
| 196 }; | 197 }; |
| 197 | 198 |
| 198 } // namespace policy | 199 } // namespace policy |
| 199 | 200 |
| 200 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 201 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| OLD | NEW |