| 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 CheckStateKeys(const std::vector<std::string>& state_keys, | 124 void HandleStateKeysResult(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 AttemptRegistration(); | 128 void StartRegistration(); |
| 129 | 129 |
| 130 // Handles the policy validation result, proceeding with installation-time | 130 // Handles the policy validation result, proceeding with device lock if |
| 131 // attributes locking if successful. | 131 // successful. |
| 132 void PolicyValidated(DeviceCloudPolicyValidator* validator); | 132 void HandlePolicyValidationResult(DeviceCloudPolicyValidator* validator); |
| 133 | 133 |
| 134 // Calls LockDevice() and proceeds to policy installation. If unsuccessful, | 134 // Calls InstallAttributes::LockDevice() for enterprise enrollment and |
| 135 // reports the result. Actual installation or error report will be done in | 135 // DeviceSettingsService::SetManagementSettings() for consumer |
| 136 // HandleLockDeviceResult(). | 136 // enrollment. |
| 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 OnSetManagementSettingsDone(); | 141 void HandleSetManagementSettingsDone(); |
| 142 | 142 |
| 143 // Helper for StartLockDevice(). It performs the actual action based on | 143 // Handle callback from InstallAttributes::LockDevice() and retry on failure. |
| 144 // the result of LockDevice. | |
| 145 void HandleLockDeviceResult( | 144 void HandleLockDeviceResult( |
| 146 EnterpriseInstallAttributes::LockResult lock_result); | 145 EnterpriseInstallAttributes::LockResult lock_result); |
| 147 | 146 |
| 148 // Stores robot auth token. | 147 // Initiates storing of robot auth token. |
| 149 void StoreRobotAuth(); | 148 void StartStoreRobotAuth(); |
| 150 | 149 |
| 151 // Handles completion of the robot token store operation. | 150 // Handles completion of the robot token store operation. |
| 152 void HandleRobotAuthTokenStored(bool result); | 151 void HandleStoreRobotAuthTokenResult(bool result); |
| 153 | 152 |
| 154 // Drops any ongoing actions. | 153 // Drops any ongoing actions. |
| 155 void Stop(); | 154 void Stop(); |
| 156 | 155 |
| 157 // Reports the result of the enrollment process to the initiator. | 156 // Reports the result of the enrollment process to the initiator. |
| 158 void ReportResult(EnrollmentStatus status); | 157 void ReportResult(EnrollmentStatus status); |
| 159 | 158 |
| 160 DeviceCloudPolicyStoreChromeOS* store_; | 159 DeviceCloudPolicyStoreChromeOS* store_; |
| 161 EnterpriseInstallAttributes* install_attributes_; | 160 EnterpriseInstallAttributes* install_attributes_; |
| 162 ServerBackedStateKeysBroker* state_keys_broker_; | 161 ServerBackedStateKeysBroker* state_keys_broker_; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 192 int lockbox_init_duration_; | 191 int lockbox_init_duration_; |
| 193 | 192 |
| 194 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 193 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
| 195 | 194 |
| 196 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 195 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
| 197 }; | 196 }; |
| 198 | 197 |
| 199 } // namespace policy | 198 } // namespace policy |
| 200 | 199 |
| 201 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 200 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| OLD | NEW |