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